home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / MPW 411 / PInterfacesHelp < prev    next >
Encoding:
Text File  |  1990-07-19  |  2.4 MB  |  79,625 lines  |  [TEXT/MPS ]

Text Truncated. Only the first 1MB is shown below. Download the file for the complete contents.
  1. æKY CopyrightNotice
  2. æC  Copyright Apple Computer, Inc. 1985-1990, All rights reserved.
  3. 411 - PInterfaces Help - QR 1 Release.
  4. Friday, July 6, 1990 3:27:56 PM
  5.  
  6. æKY Help
  7. PInterfacesHelp
  8. æKL AboutPInterfacesHelp.p
  9. ADSP.p
  10. Aliases.p
  11. AppleEvents.p
  12. AppleTalk.p
  13. Balloons.p
  14. Controls.p
  15. CursorCtl.p
  16. DatabaseAccess.p
  17. DDev.p
  18. Desk.p
  19. DeskBus.p
  20. Devices.p
  21. Dialogs.p
  22. DisAsmLookup.p
  23. DiskInit.p
  24. Disks.p
  25. Editions.p
  26. EPPC.p
  27. ErrMgr.p
  28. Errors.p
  29. Events.p
  30. Files.p
  31. FixMath.p
  32. Folders.p
  33. Fonts.p
  34. GestaltEqu.p
  35. Globals.p
  36. Graf3D.p
  37. HyperXCmd.p
  38. Lists.p
  39. Memory.p
  40. Menus.p
  41. MIDI.p
  42. Notification.p
  43. OSEvents.p
  44. OSUtils.p
  45. Packages.p
  46. Palettes.p
  47. Perf.p
  48. Picker.p
  49. Power.p
  50. PPCToolBox.p
  51. PrintTraps.p
  52. Processes.p
  53. QDOffscreen.p
  54. Quickdraw.p
  55. Resources.p
  56. Retrace.p
  57. ROMDefs.p
  58. SANE.p
  59. Scrap.p
  60. Script.p
  61. SCSI.p
  62. SCSIIntf.p
  63. SegLoad.p
  64. Serial.p
  65. ShutDown.p
  66. Signal.p
  67. Slots.p
  68. Sound.p
  69. StandardFile.p
  70. Start.p
  71. Strings.p
  72. SysEqu.p
  73. TextEdit.p
  74. Timer.p
  75. ToolUtils.p
  76. Types.p
  77. Video.p
  78. Windows.p
  79.  
  80. æKY AboutPInterfacesHelp.p
  81. æC
  82.  
  83. Version 1.0 Beta:
  84.  
  85. This version contains the InsideMacintosh Volume VI information.
  86.  
  87.  
  88.  
  89.  
  90. æKY ADSP.p
  91. æKL 
  92. attnBufSize
  93. dspAttention
  94. dspCLDeny
  95. dspCLInit
  96. dspCLListen
  97. dspClose
  98. dspCLRemove
  99. dspInit
  100. dspNewCID
  101. dspOpen
  102. dspOptions
  103. DSPParamBlock
  104. DSPPBPtr
  105. dspRead
  106. dspRemove
  107. dspReset
  108. dspStatus
  109. dspWrite
  110. eAttention
  111. eClosed
  112. eFwdReset
  113. errAborted
  114. errAttention
  115. errFwdReset
  116. errOpening
  117. errRefNum
  118. errState
  119. eTearDown
  120. ocAccept
  121. ocEstablish
  122. ocPassive
  123. ocRequest
  124. sClosed
  125. sClosing
  126. sListening
  127. sOpen
  128. sOpening
  129. sPassive
  130. TPCCB
  131. TRCCB
  132.  
  133. æKY errRefNum
  134. æFp ADSP.p
  135. æT CONST
  136. æD 
  137. {         constants                                                     
  138.  
  139.  result codes }
  140.  
  141. errRefNum = -1280; { bad connection refNum }
  142. æC 
  143.  
  144. æKY errAborted
  145. æFp ADSP.p
  146. æT CONST
  147. æD errAborted = -1279; { control call was aborted }
  148. æC 
  149.  
  150. æKY errState
  151. æFp ADSP.p
  152. æT CONST
  153. æD errState = -1278; { bad connection state for this operation }
  154. æC 
  155.  
  156. æKY errOpening
  157. æFp ADSP.p
  158. æT CONST
  159. æD errOpening = -1277; { open connection request was denied }
  160. æC 
  161.  
  162. æKY errAttention
  163. æFp ADSP.p
  164. æT CONST
  165. æD errAttention = -1276; { attention message too long }
  166. æC 
  167.  
  168. æKY errFwdReset
  169. æFp ADSP.p
  170. æT CONST
  171. æD errFwdReset = -1275; { read terminated by forward reset }
  172. æC 
  173.  
  174. æKY dspInit
  175. æFp ADSP.p
  176. æT CONST
  177. æD 
  178. {  control codes }
  179.  
  180. dspInit = 255; { create a new connection end }
  181. æC 
  182.  
  183. æKY dspRemove
  184. æFp ADSP.p
  185. æT CONST
  186. æD dspRemove = 254; { remove a connection end }
  187. æC 
  188.  
  189. æKY dspOpen
  190. æFp ADSP.p
  191. æT CONST
  192. æD dspOpen = 253; { open a connection }
  193. æC 
  194.  
  195. æKY dspClose
  196. æFp ADSP.p
  197. æT CONST
  198. æD dspClose = 252; { close a connection }
  199. æC 
  200.  
  201. æKY dspCLInit
  202. æFp ADSP.p
  203. æT CONST
  204. æD dspCLInit = 251; { create a connection listener }
  205. æC 
  206.  
  207. æKY dspCLRemove
  208. æFp ADSP.p
  209. æT CONST
  210. æD dspCLRemove = 250; { remove a connection listener }
  211. æC 
  212.  
  213. æKY dspCLListen
  214. æFp ADSP.p
  215. æT CONST
  216. æD dspCLListen = 249; { post a listener request }
  217. æC 
  218.  
  219. æKY dspCLDeny
  220. æFp ADSP.p
  221. æT CONST
  222. æD dspCLDeny = 248; { deny an open connection request }
  223. æC 
  224.  
  225. æKY dspStatus
  226. æFp ADSP.p
  227. æT CONST
  228. æD dspStatus = 247; { get status of connection end }
  229. æC 
  230.  
  231. æKY dspRead
  232. æFp ADSP.p
  233. æT CONST
  234. æD dspRead = 246; { read data from the connection }
  235. æC 
  236.  
  237. æKY dspWrite
  238. æFp ADSP.p
  239. æT CONST
  240. æD dspWrite = 245; { write data on the connection }
  241. æC 
  242.  
  243. æKY dspAttention
  244. æFp ADSP.p
  245. æT CONST
  246. æD dspAttention = 244; { send an attention message }
  247. æC 
  248.  
  249. æKY dspOptions
  250. æFp ADSP.p
  251. æT CONST
  252. æD dspOptions = 243; { set connection end options }
  253. æC 
  254.  
  255. æKY dspReset
  256. æFp ADSP.p
  257. æT CONST
  258. æD dspReset = 242; { forward reset the connection }
  259. æC 
  260.  
  261. æKY dspNewCID
  262. æFp ADSP.p
  263. æT CONST
  264. æD dspNewCID = 241; { generate a cid for a connection end }
  265. æC 
  266.  
  267. æKY ocRequest
  268. æFp ADSP.p
  269. æT CONST
  270. æD 
  271. {  connection opening modes }
  272.  
  273. ocRequest = 1; { request a connection with remote }
  274. æC 
  275.  
  276. æKY ocPassive
  277. æFp ADSP.p
  278. æT CONST
  279. æD ocPassive = 2; { wait for a connection request from remote }
  280. æC 
  281.  
  282. æKY ocAccept
  283. æFp ADSP.p
  284. æT CONST
  285. æD ocAccept = 3; { accept request as delivered by listener }
  286. æC 
  287.  
  288. æKY ocEstablish
  289. æFp ADSP.p
  290. æT CONST
  291. æD ocEstablish = 4; { consider connection to be open }
  292. æC 
  293.  
  294. æKY sListening
  295. æFp ADSP.p
  296. æT CONST
  297. æD 
  298. {  connection end states }
  299.  
  300. sListening = 1; { for connection listeners }
  301. æC 
  302.  
  303. æKY sPassive
  304. æFp ADSP.p
  305. æT CONST
  306. æD sPassive = 2; { waiting for a connection request from remote }
  307. æC 
  308.  
  309. æKY sOpening
  310. æFp ADSP.p
  311. æT CONST
  312. æD sOpening = 3; { requesting a connection with remote }
  313. æC 
  314.  
  315. æKY sOpen
  316. æFp ADSP.p
  317. æT CONST
  318. æD sOpen = 4; { connection is open }
  319. æC 
  320.  
  321. æKY sClosing
  322. æFp ADSP.p
  323. æT CONST
  324. æD sClosing = 5; { connection is being torn down }
  325. æC 
  326.  
  327. æKY sClosed
  328. æFp ADSP.p
  329. æT CONST
  330. æD sClosed = 6; { connection end state is closed }
  331. æC 
  332.  
  333. æKY eClosed
  334. æFp ADSP.p
  335. æT CONST
  336. æD 
  337. {  client event flags }
  338.  
  339. eClosed = $80; { received connection closed advice }
  340. æC 
  341.  
  342. æKY eTearDown
  343. æFp ADSP.p
  344. æT CONST
  345. æD eTearDown = $40; { connection closed due to broken connection }
  346. æC 
  347.  
  348. æKY eAttention
  349. æFp ADSP.p
  350. æT CONST
  351. æD eAttention = $20; { received attention message }
  352. æC 
  353.  
  354. æKY eFwdReset
  355. æFp ADSP.p
  356. æT CONST
  357. æD eFwdReset = $10; { received forward reset advice }
  358. æC 
  359.  
  360. æKY attnBufSize
  361. æFp ADSP.p
  362. æT CONST
  363. æD 
  364. {  miscellaneous constants }
  365.  
  366. attnBufSize = 570; { size of client attention buffer }
  367. æC 
  368.  
  369. æKY TRCCB
  370. TPCCB
  371. æFp ADSP.p
  372. æT RECORD
  373. æD TPCCB = ^TRCCB;
  374. TRCCB = PACKED RECORD
  375.     ccbLink: TPCCB; { link to next ccb }
  376.     refNum: INTEGER; { user reference number }
  377.     state: INTEGER; { state of the connection end }
  378.     userFlags: Byte; { flags for unsolicited connection events }
  379.     localSocket: Byte; { socket number of this connection end }
  380.     remoteAddress: AddrBlock; { internet address of remote end }
  381.     attnCode: INTEGER; { attention code received }
  382.     attnSize: INTEGER; { size of received attention data }
  383.     attnPtr: Ptr; { ptr to received attention data }
  384.     reserved: PACKED ARRAY [1..220] OF Byte; { adsp internal use }
  385.     END;
  386. æC 
  387.  
  388. æKY DSPParamBlock
  389. DSPPBPtr
  390. æFp ADSP.p
  391. æT RECORD
  392. æD DSPPBPtr = ^DSPParamBlock;
  393. DSPParamBlock = RECORD
  394.     qLink: QElemPtr;
  395.     qType: INTEGER;
  396.     ioTrap: INTEGER;
  397.     ioCmdAddr: Ptr;
  398.     ioCompletion: ProcPtr;
  399.     ioResult: OSErr;
  400.     ioNamePtr: StringPtr;
  401.     ioVRefNum: INTEGER;
  402.     ioCRefNum: INTEGER; { adsp driver refnum }
  403.     csCode: INTEGER; { adsp driver control code }
  404.     qStatus: LONGINT; { adsp internal use }
  405.     ccbRefNum: INTEGER; { connection end reNum}
  406.     CASE Integer OF
  407.       dspInit,dspCLInit:
  408.         (ccbPtr: TPCCB; {pointer to connection control block}
  409.          userRoutine: ProcPtr; {client routine to call on event}
  410.          sendQSize: INTEGER; {size of send queue (0..64K bytes)}
  411.          sendQueue:  Ptr; {client passed send queue buffer}
  412.          recvQSize: INTEGER; {size of receive queue (0..64K bytes)}
  413.          recvQueue: Ptr ; {client passed receive queue buffer}
  414.          attnPtr: Ptr; {client passed receive attention buffer}
  415.          localSocket: Byte; {local socket number}
  416.          filler1: Byte; {filler for proper byte alignment}}
  417.           );
  418.           dspOpen,dspCLListen,dspCLDeny:
  419.             (localCID: INTEGER; {local connection id}
  420.              remoteCID: INTEGER; {remote connection id}
  421.              remoteAddress: AddrBlock; {address of remote end}
  422.              filterAddress: AddrBlock; {address filter}
  423.              sendSeq: LONGINT; {local send sequence number}
  424.              sendWindow: INTEGER; {send window size}
  425.              recvSeq: LONGINT; {receive sequence number}
  426.              attnSendSeq: LONGINT; {attention send sequence number}
  427.              attnRecvSeq: LONGINT; {attention receive sequence number}
  428.              ocMode: Byte; {open connection mode}
  429.              ocInterval: Byte; {open connection request retry interval}
  430.              ocMaximum: Byte; {open connection request retry maximum}
  431.              filler2: Byte; {filler for proper byte alignment}
  432.               );
  433.               dspClose,dspRemove:
  434.                 (abort: Byte; {abort connection immediately if non-zero}
  435.                  filler3: Byte; {filler for proper byte alignment}
  436.                   );
  437.                   dspStatus:
  438.                     (statusCCB: TPCCB; {pointer to ccb}
  439.                      sendQPending: INTEGER; {pending bytes in send queue}
  440.                      sendQFree: INTEGER; {available buffer space in send queue}
  441.                      recvQPending: INTEGER; {pending bytes in receive queue}
  442.                      recvQFree: INTEGER; {available buffer space in receive queue}
  443.                       );
  444.                       dspRead,dspWrite:
  445.                         (reqCount: INTEGER; {requested number of bytes}
  446.                          actCount: INTEGER; {actual number of bytes}
  447.                          dataPtr: Ptr; {pointer to data buffer}
  448.                          eom: Byte; {indicates logical end of message}
  449.                          flush: Byte; {send data now}
  450.                           );
  451.                           dspAttention:
  452.                             (attnCode: INTEGER; {client attention code}
  453.                              attnSize: INTEGER; {size of attention data}
  454.                              attnData: Ptr; {pointer to attention data}
  455.                              attnInterval: Byte; {retransmit timer in 10-tick intervals}
  456.                              filler4: Byte; {filler for proper byte alignment}
  457.                               );
  458.                               dspOptions:
  459.                                 (sendBlocking: INTEGER; {quantum for data packets}
  460.                                  sendTimer: Byte; {send timer in 10-tick intervals}
  461.                                  rtmtTimer: Byte; {retransmit timer in 10-tick intervals}
  462.                                  badSeqMax: Byte; {threshold for sending retransmit advice}
  463.                                  useCheckSum: Byte; {use ddp packet checksum}
  464.                                   );
  465.                                   dspNewCID:
  466.                                     (newCID: INTEGER; {new connection id returned}
  467.                                       );
  468.     END;
  469. æC 
  470.  
  471.  
  472. æKY Aliases.p
  473. æKL CanonifyFile
  474. GetAliasInfo
  475. MatchAlias
  476. NewAlias
  477. NewAliasMinimal
  478. NewAliasMinimalFromFullpath
  479. ResolveAlias
  480. SelectAlias
  481. UpdateAlias
  482.  
  483. AliasHandle
  484. AliasInfoType
  485. AliasPtr
  486. AliasRecord
  487. asiAliasName
  488. asiParentName
  489. asiServerName
  490. asiVolumeName
  491. asiZoneName
  492. CanonicalFileSpec
  493. CanonicalFileSpecList
  494. CanonicalFileSpecListPtr
  495. kARMmountVol
  496. kARMmultVols
  497. kARMnoUI
  498. kARMsearch
  499. kARMsearchMore
  500. kARMsearchRelFirst
  501. rAliasType
  502.  
  503. æKY rAliasType
  504. æFp Aliases.p
  505. æT CONST
  506. æD 
  507.     Constants 
  508.  }
  509.  
  510. rAliasType = 'alis'; { Aliases are stored as resources of this type }
  511. æC 
  512.  
  513. æKY kARMmountVol
  514. æFp Aliases.p
  515. æT CONST
  516. æD 
  517. {  define alias resolution action rules mask }
  518.  
  519. kARMmountVol = $00000001; { mount the volume automatically }
  520. æC 
  521.  
  522. æKY kARMnoUI
  523. æFp Aliases.p
  524. æT CONST
  525. æD kARMnoUI = $00000002; { no user interface allowed during resolution }
  526. æC 
  527.  
  528. æKY kARMmultVols
  529. æFp Aliases.p
  530. æT CONST
  531. æD kARMmultVols = $00000008; { search on multiple volumes }
  532. æC 
  533.  
  534. æKY kARMsearch
  535. æFp Aliases.p
  536. æT CONST
  537. æD kARMsearch = $00000100; { search quickly }
  538. æC 
  539.  
  540. æKY kARMsearchMore
  541. æFp Aliases.p
  542. æT CONST
  543. æD kARMsearchMore = $00000200; { search further }
  544. æC 
  545.  
  546. æKY kARMsearchRelFirst
  547. æFp Aliases.p
  548. æT CONST
  549. æD kARMsearchRelFirst = $00000400; { search target on a relative path first }
  550. æC 
  551.  
  552. æKY asiZoneName
  553. æFp Aliases.p
  554. æT CONST
  555. æD 
  556. {  define alias record information types }
  557.  
  558. asiZoneName = -3; { get zone name }
  559. æC 
  560.  
  561. æKY asiServerName
  562. æFp Aliases.p
  563. æT CONST
  564. æD asiServerName = -2; { get server name }
  565. æC 
  566.  
  567. æKY asiVolumeName
  568. æFp Aliases.p
  569. æT CONST
  570. æD asiVolumeName = -1; { get volume name }
  571. æC 
  572.  
  573. æKY asiAliasName
  574. æFp Aliases.p
  575. æT CONST
  576. æD asiAliasName = 0; { get aliased file/folder/volume name }
  577. æC 
  578.  
  579. æKY asiParentName
  580. æFp Aliases.p
  581. æT CONST
  582. æD asiParentName = 1; { get parent folder name }
  583. æC 
  584.  
  585. æKY CanonicalFileSpec
  586. CanonicalFileSpecList
  587. æFp Aliases.p
  588. æT RECORD
  589. æD CanonicalFileSpecList = ^CanonicalFileSpec;
  590. CanonicalFileSpec = RECORD
  591.     vRefNum: INTEGER; { volume reference number }
  592.     dirID: LONGINT; { directory ID }
  593.     fileName: Str63; { file name }
  594.     END;
  595. æC 
  596.  
  597.  
  598. æKY AliasRecord
  599. AliasPtr
  600. AliasHandle
  601. æFp Aliases.p
  602. æT RECORD
  603. æD AliasPtr = ^AliasRecord;
  604. AliasHandle = ^AliasPtr;
  605. AliasRecord = RECORD
  606.     userType: OSType; { appl stored type like creator type }
  607.     aliasSize: INTEGER; { alias record size in bytes, for appl usage}
  608.     END;
  609. {  define the alias record that will be the blackbox for the caller  }
  610. æC 
  611.  
  612. æKY AliasInfoType
  613. æFp Aliases.p
  614. æT RECORD
  615. æD AliasInfoType = INTEGER; { alias record information type }
  616. æC 
  617.  
  618. æKY CanonifyFile
  619. æFp Aliases.p
  620. æT FUNCTION
  621. æTN A823
  622. æD FUNCTION CanonifyFile(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;
  623.     VAR canonicalFile: CanonicalFileSpec): OSErr;
  624.     INLINE $7001,$A823;
  625. {        Public Interfaces 
  626.  
  627.      High Level Routines
  628.  
  629. given a volume reference number (or a working directory reference number), directory ID and a file name, return the canonical form of the specified file }
  630. æDT myVariable := CanonifyFile(vRefNum,dirID,fileName,canonicalFile);
  631. æC 
  632.  
  633. æKY NewAlias
  634. æFp Aliases.p
  635. æT FUNCTION
  636. æTN A823
  637. æD FUNCTION NewAlias(fromFile: CanonicalFileSpecPtr;target: CanonicalFileSpec;
  638.     VAR alias: AliasHandle): OSErr;
  639.     INLINE $7002,$A823;
  640. {  create a new alias between fromFile-target and return alias record handle  }
  641. æDT myVariable := NewAlias(fromFile,target,alias);
  642.  
  643. æC 
  644. You use the NewAlias function to create an alias record.
  645.  
  646. FUNCTION NewAlias (fromFile,target: FSSpecPtr; VAR alias: AliasHandle) : OSErr;
  647.  
  648. NewAlias creates an alias record that describes the object specified in the
  649. target parameter. It fills in the record and puts a record handle in the alias
  650. parameter.
  651.  
  652. The fromFile parameter represents the starting point for a relative search. This
  653. parameter can be either NIL or a pointer to a valid FSSpec record. If fromFile
  654. is NIL, the alias record does not include relative path information. Specify a
  655. value for fromFile only if you want NewAlias to record relative path
  656. information.
  657.  
  658. The target parameter points to a FSSpec record for the file, folder, or volume
  659. to be described by the alias record.
  660.  
  661. The alias parameter is the handle for the newly created alias record. If the
  662. function fails to create an alias record, it sets alias to NIL.
  663.  
  664. Result codes
  665. paramErr  -50  The target parameter is NIL
  666.  
  667. æKY NewAliasMinimal
  668. æFp Aliases.p
  669. æT FUNCTION
  670. æTN A823
  671. æD FUNCTION NewAliasMinimal(target: CanonicalFileSpec;VAR alias: AliasHandle): OSErr;
  672.     INLINE $7008,$A823;
  673. { create a minimal new alias for a target and return alias record handle }
  674. æDT myVariable := NewAliasMinimal(target,alias);
  675. æC 
  676.  
  677. æKY NewAliasMinimalFromFullpath
  678. æFp Aliases.p
  679. æT FUNCTION
  680. æTN A823
  681. æD FUNCTION NewAliasMinimalFromFullpath(fullpathLength: INTEGER;fullpath: Ptr;
  682.     zoneName: Str31;serverName: Str31;VAR alias: AliasHandle): OSErr;
  683.     INLINE $7009,$A823;
  684. { create a minimal new alias from a target fullpath (optional zone and server name) and return alias record handle
  685.  }
  686. æDT myVariable := NewAliasMinimalFromFullpath(fullpathLength,fullpath,zoneName,serverName,alias);
  687. æC 
  688.  
  689. æKY ResolveAlias
  690. æFp Aliases.p
  691. æT FUNCTION
  692. æTN A823
  693. æD FUNCTION ResolveAlias(fromFile: CanonicalFileSpecPtr;alias: AliasHandle;
  694.     VAR target: CanonicalFileSpec;VAR wasChanged: BOOLEAN): OSErr;
  695.     INLINE $7003,$A823;
  696. { given an alias handle and fromFile, resolve the alias, update the alias record and return aliased filename and wasChanged flag. }
  697. æDT myVariable := ResolveAlias(fromFile,alias,target,wasChanged);
  698. æC 
  699. You use the ResolveAlias function to resolve an alias. 
  700.  
  701. FUNCTION ResolveAlias (fromFile: FSSpecPtr; alias: AliasHandle; VAR target: 
  702.                        FSSpec; VAR wasChanged: Boolean) : OSErr;
  703.  
  704. If the resolution is successful, ResolveAlias returns the FSSpec record for the
  705. target filename through the target parameter, updates the alias record if
  706. necessary, and reports whether or not the record was updated through the
  707. wasChanged parameter. If the target object is on an unmounted AppleShare volume,
  708. ResolveAlias automatically mounts the volume. If the target is on an unmounted,
  709. ejectable volume, ResolveAlias displays a switch-disk dialog box. ResolveAlias
  710. exits after it finds one acceptable target.
  711.  
  712. The fromFile parameter represents the starting point for a relative search. This
  713. parameter can be either NIL or a valid FSSpec record. If fromFile is NIL,
  714. ResolveAlias does not perform a relative sesarch.
  715.  
  716. The alias parameter points to the alias record to be resolved and, if necessary,
  717. updated.
  718.  
  719. The Target parameter receives the FSSpec record of the target filename.
  720.  
  721. If it updates the alias record, ResolveAlias sets the wasChanged parameter to
  722. TRUE. Otherwise, it sets it to FALSE. If the function returns an error code, it
  723. sets wasChanged to FALSE.
  724.  
  725. Result codes
  726. nsvErr    -35  The volume is not mounted
  727. fnfErr    -43  No target was found
  728. paramErr  -50  The alias parameter is NIL, or the handle is corrupt
  729.  
  730.  
  731. æKY SelectAlias
  732. æFp Aliases.p
  733. æT FUNCTION
  734. æTN A823
  735. æD FUNCTION SelectAlias(fromFile: CanonicalFileSpecPtr;fileTypeName: Str31;
  736.     aliasFilter: Boolean;alias: AliasHandle;VAR target: CanonicalFileSpec;
  737.     VAR wasChanged: BOOLEAN;filterProc: Boolean;yourDataPtr: Ptr): OSErr;
  738.     INLINE $7004,$A823;
  739. { given a fromFile and alias handle, match the alias and return aliased entity.  If more than one match is found or no match is found, a dialog box is put up.    The user directs his search for the correct alias through this dialog box. }
  740. æDT myVariable := SelectAlias(fromFile,fileTypeName,aliasFilter,alias,target,wasChanged,filterProc,yourDataPtr);
  741. æC 
  742. If you want the user to direct the search when an alias record cannot be
  743. resolved unambiguously, call the SelectAlias function.
  744.  
  745. FUNCTION SelectAlias (fromFile: FSSpecPtr; fileTypeName: Str31; aliasFilter: 
  746.                       ProcPtr; alias: AliasHandle; VAR target: FSSpec; VAR 
  747.                       wasChanged: Boolean; filterProc: ProcPtr; callbackPtr:
  748.                       Ptr) : OSErr;
  749.  
  750. If SelectAlias finds a single match for the record pointed to by the alias
  751. parameter, it behaves the same way as ResolveAlias. If SelectAlias finds no
  752. matches or more than one match for the record, the Alias Manager presents a
  753. modal dialog box that allows the user to direct the search and select the
  754. target. (See “User-Directed Search” for a description of the dialog box.)
  755.  
  756. The fromFile parameter represents the starting point for a relative search. This
  757. parameter can be either NIL or a valid FSSpec. If fromFile is NIL, SelectAlias
  758. does not perform a relative search.
  759.  
  760. The fileTypeName string is a descriptive name for the file type of the target
  761. object, intended to help the user select the correct target. It appears as part
  762. of the title of the dialog box.
  763.  
  764. The aliasFilter parameter points to an optional filter function supplied by your
  765. application. The Alias Manager executes this function for each possible match
  766. that SelectAlias finds or after three seconds have elapsed without  a match.
  767. Your filter function returns a Boolean value that determines whether the
  768. possible match is to be discarded (TRUE) or displayed (FALSE). It can also
  769. terminate the search. The function has three parameters.
  770.  
  771.    FUNCTION MySelectAliasFilter (paramBlock: CInfoPBPtr; VAR quitFlag: Boolean; 
  772.                                  callbackPtr: Ptr) : Boolean
  773.  
  774.   The paramBlock parameter points to the catalog information parameter block    
  775.   record (as returned by the File Manager function PBGetCatInfo) of the alias 
  776.   match. The Alias Manager sets this parameter to NIL if it is calling the 
  777.   function to give it the chance to terminate the search. (Do not use this 
  778.   pointer without checking for NIL.) Your filter function sets the quitFlag 
  779.   parameter to terminate the search.
  780.  
  781.   The callbackPtr parameter is the same as the SelectAlias input parameter   
  782.   callbackPtr. This parameter allows your filter function to access your global 
  783.   or local data.
  784.  
  785.  
  786. The alias parameter points to the alias record to be resolved and, if 
  787. necessary, updated.
  788.  
  789. After the alias is resolved to a single target, the target parameter receives
  790. the FSSpec for the target.
  791.  
  792. If it updates the alias record, SelectAlias sets the wasChanged parameter to
  793. TRUE. Otherwise, it sets it to FALSE. If the function returns an error code, it
  794. sets wasChanged to FALSE.
  795.  
  796. The filterProc parameter points to your application’s optional event-filtering
  797. function, to be called by ModalDialog. (SelectAlias calls ModalDialog when it
  798. displays the SelectAlias dialog box. For a description of the ModalDialog
  799. procedure, see the Dialog Manager chapter of Volume I.) The filterProc parameter
  800. is similar to the same parameter in the Standard File Package procedure
  801. SFPGetFile. The function pointed to by filterProc must be the same as the one
  802. you would pass directly to ModalDialog in its filterProc parameter, except that
  803. it takes an additional fourth argument, which is the callbackPtr parameter as
  804. passed to the SelectAlias routine. This option allows your filter function to
  805. access the value of callbackPtr to retrieve your data.
  806.  
  807. The callbackPtr parameter contains whatever data you specify. Use this parameter
  808. to pass information to your filter function.
  809.  
  810. Result codes
  811. fnfErr            -43  No target was found
  812. paramErr          -50  target, alias, or both are NIL, or the handle is corrupt
  813. userCanceledErr  -128  The user canceled the operation
  814.  
  815. æKY GetAliasInfo
  816. æFp Aliases.p
  817. æT FUNCTION
  818. æTN A823
  819. æD FUNCTION GetAliasInfo(alias: AliasHandle;index: AliasInfoType;VAR theString: Str63): OSErr;
  820.     INLINE $7007,$A823;
  821. { given an alias handle and an index specifying requested alias information type, return the information from alias record as a string. }
  822. æDT myVariable := GetAliasInfo(alias,index,theString);
  823. æC 
  824. You can use the GetAliasInfo function to read information from an alias record.
  825.  
  826. FUNCTION GetAliasInfo (alias: AliasHandle; index: AliasInfoType; VAR theString:
  827.                        Str63 ) : OSErr;
  828.  
  829. GetAliasInfo retrieves the information specified by the index parameter from the
  830. record pointed to by the alias parameter and places it in the parameter
  831. theString.
  832.  
  833. The alias parameter points to the alias record to be read.
  834.  
  835. The index parameter specifies the kind of information to be retrieved. If index
  836. is a positive integer, GetAliasInfo retrieves the parent folder that has the
  837. same hierarchical level as the index parameter. You can therefore assemble the
  838. names of the target and all of its parent folders by making repeated calls to
  839. GetAliasInfo with incrementing index values, starting with a value of 0. When
  840. index is greater than the hierarchical level of the root, GetAliasInfo returns
  841. an empty string. You can also set index to one of these five values:
  842.  
  843. Constant      Value  Description
  844. asiZoneName    -3    If the record represents an object on an AppleShare volume,
  845.  
  846.                      retrieve the server’s zone name. Otherwise, return an empty
  847.                      string.
  848.  
  849. asiServerName  -2    If the record represents an object on an AppleShare volume,
  850.  
  851.                      retrieve server name. Otherwise, return an empty string.
  852.  
  853. asiVolumeName  -1    Return the name of the volume on which the represented 
  854.                      object resides.
  855.  
  856. asiAliasName    0    Return the name of the object represented by the record.
  857.  
  858. asiParentName   1    Return the name of the parent folder of the object 
  859.                      represented by the record. If the object is a volume, 
  860.                      return the volume name.
  861.  
  862. GetAliasInfo places the requested information in the parameter theString.
  863.  
  864. GetAliasInfo returns the information stored in the alias record, which might not
  865. be current.
  866.  
  867. Result codes
  868. paramErr  -50  alias, theString, or both are NIL; the index is less
  869.                than asiZoneName; or the handle is corrupt
  870.  
  871.  
  872. æKY MatchAlias
  873. æFp Aliases.p
  874. æT FUNCTION
  875. æTN A823
  876. æD FUNCTION MatchAlias(fromFile: CanonicalFileSpecPtr;rulesMask: unsigned long;
  877.     alias: AliasHandle;VAR aliasCount: INTEGER;aliasList: CanonicalFileSpecListPtr;
  878.     VAR needsUpdate: BOOLEAN;aliasFilter: Boolean;yourDataPtr: Ptr): OSErr;
  879.     INLINE $7005,$A823;
  880. {   Low Level Routines 
  881. given an alias handle and fromFile, match the alias and return aliased filename(s) and needsUpdate flag }
  882. æDT myVariable := MatchAlias(fromFile,rulesMask,alias,aliasCount,aliasList,needsUpdate,aliasFilter,yourDataPtr);
  883. æC 
  884. You use the MatchAlias function to identify a list of possible matches and pass
  885. the list through a selection filter. The filter can pass more than one possible
  886. match.
  887.  
  888. FUNCTION MatchAlias (fromFile: FSSpecPtr; rulesMask: LongInt; alias:
  889. AliasHandle;   
  890.                      VAR aliasCount: Integer; aliasList: FSSpecListPtr; VAR
  891.                      needsUpdate: Boolean; aliasFilter: ProcPtr; callbackPtr:
  892.                      Ptr) : OSErr;
  893.  
  894. MatchAlias resolves the alias record pointed to by the alias parameter and
  895. returns a list of FSSpec records in the structure pointed to by the aliasList
  896. parameter. If it identifies more than one possible target, MatchAlias places in
  897. the aliasCount parameter the number of candidates in aliasList. MatchAlias
  898. follows the rules specified by the rulesMask parameter. If it resolves the alias
  899. to an object other than the one stored in the alias record or if it returns a
  900. list of possible candidates, it sets the needsUpdate flag to TRUE. Your
  901. application is responsible for calling UpdateAlias if necessary after the target
  902. is identified.
  903.  
  904. The fromFile parameter represents the starting point for a relative search. This
  905. parameter can be either NIL or a valid FSSpec record. If fromFile is NIL,
  906. MatchAlias does not perform a relative search.
  907.  
  908. The rulesMask parameter specifies a set of rules to guide the resolution. Pass
  909. the sum of all of the rules you want to invoke.
  910.  
  911. Constant        Description
  912.  
  913. kARMmountVol    Automatically try to mount the target’s volume if it is not    
  914.                 mounted.  If this rule is not set, and if the target’s volume is
  915.  
  916.                 not mounted, MatchAlias returns nsvErr.
  917.  
  918. kARMmultVols    Search all mounted volumes. The search begins with the volume on
  919.  
  920.                 which the target resided when the record was created.
  921.  
  922. kARMsearch      Search quickly for the alias, using the fast-search algorithm.
  923.  
  924. kARMsearchMore  Search further, using the slow-search algorithm.
  925.  
  926.                 The further search uses the File Manager function CatSearch to
  927.                 match criteria such as creation date, type, and creator.
  928.                 CatSearch is available only on HFS volumes. When searching MFS
  929.                 volumes or AppleShare volumes running older system software, 
  930.                 MatchAlias performs a recursive, indexing search using creation 
  931.                 date, type, and creator.
  932.  
  933.                 If both kARMsearch and kARMsearchMore are set, MatchAlias 
  934.                 performs a fast search followed by a slow search.
  935.  
  936. The alias parameter points to the alias record to be resolved.
  937.  
  938. Your application can specify a maximum number of possible matches by setting the
  939. aliasCount parameter. MatchAlias sets the aliasCount parameter to the number of
  940. entries in the list of possible matches.
  941.  
  942. The aliasList parameter points to the array that holds the results of the
  943. search.
  944.  
  945. If MatchAlias resolves the alias to a target whose key information is different,
  946. or if it returns a list of possible candidates, it sets the needsUpdate flag to
  947. TRUE. Otherwise, it sets it to FALSE.
  948.  
  949. The aliasFilter parameter points to a filter function supplied by your
  950. application. The Alias Manager executes this function for each possible match
  951. that MatchAlias finds or after three seconds have elapsed without  a match. Your
  952. filter function returns a Boolean value that determines whether the possible
  953. match is discarded (TRUE) or added to the list of possible targets (FALSE). It
  954. can also terminate the search. The function has three parameters.
  955.  
  956.    FUNCTION MyMatchAliasFilter (paramBlock: CInfoPBPtr; VAR quitFlag: Boolean;  
  957.                                 callbackPtr: Ptr): Boolean
  958.    The paramBlock parameter points to the catalog information parameter block  
  959.  
  960.    record (as returned by the File Manager function PBGetCatInfo) of the alias 
  961.    match. The Alias Manager sets this parameter to NIL if it is calling the 
  962.    function to give it the chance to terminate the search. (Do not use this 
  963.    pointer without checking for NIL.) Your filter function sets the quitFlag 
  964.    parameter to terminate the search.
  965.  
  966.    The callbackPtr parameter is the same as the MatchAlias input parameter   
  967.    callbackPtr. This parameter allows your filter function to access your global
  968.  
  969.    or local data.
  970.  
  971.  
  972.    The callbackPtr parameter contains whatever data you specify. Use this 
  973.    parameter to pass information to your filter function.
  974.  
  975. Result codes
  976. nsvErr            -35  The volume is not mounted
  977. fnfErr            -43  No target was found
  978. paramErr          -50  target, alias, or both are NIL, or the handle is corrupt
  979. userCanceledErr  -128  The user canceled the operation
  980.  
  981. æKY UpdateAlias
  982. æFp Aliases.p
  983. æT FUNCTION
  984. æTN A823
  985. æD FUNCTION UpdateAlias(fromFile: CanonicalFileSpecPtr;target: CanonicalFileSpec;
  986.     alias: AliasHandle;VAR wasChanged: BOOLEAN): OSErr;
  987.     INLINE $7006,$A823;
  988. { given a fromFile-target pair and an alias handle, update the lias record pointed to by alias handle to represent target as the new alias. }
  989. æDT myVariable := UpdateAlias(fromFile,target,alias,wasChanged);
  990.  
  991. æC 
  992. You use the UpdateAlias function to update an alias record.
  993.  
  994. FUNCTION UpdateAlias (fromFile,target: FSSpecPtr; alias: AliasHandle; VAR 
  995.                       wasChanged: Boolean) : OSErr;
  996.  
  997. UpdateAlias updates the alias record pointed to by the alias parameter so that
  998. it describes the file, folder, or volume specified by the target parameter.
  999. UpdateAlias rebuilds the entire alias record.
  1000.  
  1001. The fromFile parameter represents the starting point for a relative search. This
  1002. parameter can be either NIL or a pointer to a valid FSSpec record. If fromFile
  1003. is NIL, the updated alias record does not include relative path information.
  1004. Specify a value for fromFile only if you want UpdateAlias to record relative
  1005. path information.
  1006.  
  1007. The target parameter is the target of the alias record. This parameter must
  1008. point to a valid canonical file specification record.
  1009.  
  1010. The alias parameter points to the alias record to be updated.
  1011.  
  1012. If the newly constructed alias record is exactly the same as the old one,
  1013. UpdateAlias sets the wasChanged parameter to FALSE. Otherwise, it sets it to
  1014. TRUE. Check this parameter to determine whether you need to save an updated
  1015. record.
  1016.  
  1017. Result codes
  1018. paramErr  -50  target, alias, or both are NIL, or the handle is corrupt
  1019.  
  1020.  
  1021. æKY AppleEvents.p
  1022. æKL AEAddEvtToTable
  1023. AECoerceDesc
  1024. AECountListElems
  1025. AECreateAevt
  1026. AECreateDispatchTable
  1027. AECreateList
  1028. AEDeleteIndex
  1029. AEDeleteKey
  1030. AEDisposeAEDesc
  1031. AEDisposeAEList
  1032. AEGetAddress
  1033. AEGetArray
  1034. AEGetDispatchTableRsrc
  1035. AEGetEventClassAndID
  1036. AEGetInteractLevel
  1037. AEGetKeyDesc
  1038. AEGetKeyPtr
  1039. AEGetNthDesc
  1040. AEGetNthPtr
  1041. AEGetRefCon
  1042. AEGetTableEntry
  1043. AEInit
  1044. AEInteractionAllowed
  1045. AEInteractWithUser
  1046. AEProcessAppleEvent
  1047. AEPutArray
  1048. AEPutDesc
  1049. AEPutKeyDesc
  1050. AEPutKeyPtr
  1051. AEPutPtr
  1052. AEQuit
  1053. AEResetTimer
  1054. AESend
  1055. AESetAddressByPSN
  1056. AESetAddressBySessionID
  1057. AESetAddressBySignature
  1058. AESetAddressByTargetID
  1059. AEWhichAevt
  1060.  
  1061. AEAddress
  1062. AEAddressHndl
  1063. AEAddressPtr
  1064. AEArrayType
  1065. AEDesc
  1066. AEInteractAllowed
  1067. AEKeyDesc
  1068. kAEAliasType
  1069. kAEAlwaysInteract
  1070. kAEBadListElement
  1071. kAEBooleanType
  1072. kAECanInteract
  1073. kAECanSwitchLayer
  1074. kAECoercionFail
  1075. kAECorruptData
  1076. kAEDataArray
  1077. kAEDescArray
  1078. kAEDescNotFound
  1079. kAEDirectObjectKeyword
  1080. kAEDontReconnect
  1081. kAEEventNotFound
  1082. kAEEventNotInTable
  1083. kAEFalseType
  1084. kAEHandleArray
  1085. kAEHighPriority
  1086. kAEInteractionWithSelf
  1087. kAEInteractWithAll
  1088. kAEInteractWithLocal
  1089. kAEKeyDescArray
  1090. kAEListType
  1091. kAELongType
  1092. kAENeverInteract
  1093. kAENoReply
  1094. kAENormalPriority
  1095. kAENotAEList
  1096. kAENotAppleEvent
  1097. kAENoUserInteraction
  1098. kAEOpenApplication
  1099. kAEOpenDocuments
  1100. kAEPackedArray
  1101. kAEPrintDocuments
  1102. kAEQueueReply
  1103. kAEQuitApplication
  1104. kAEReplyNotValid
  1105. kAETimeoutErr
  1106. kAETrueType
  1107. kAEUnknownInteract
  1108. kAEUnknownSendMode
  1109. KAEWaitCanceled
  1110. kAEWaitReply
  1111. kAEWantReceipt
  1112. kAEWildType
  1113. kAEWrongDataType
  1114. kAEWrongVersion
  1115. kAutoGenerateRefcon
  1116. kCoreEventClass
  1117.  
  1118. æKY kAELongType
  1119. æFp AppleEvents.p
  1120. æT CONST
  1121. æD kAELongType = 'long';
  1122. æC 
  1123.  
  1124. æKY kAEListType
  1125. æFp AppleEvents.p
  1126. æT CONST
  1127. æD kAEListType = 'list';
  1128. æC 
  1129.  
  1130. æKY kAEWildType
  1131. æFp AppleEvents.p
  1132. æT CONST
  1133. æD kAEWildType = '****';
  1134. æC 
  1135.  
  1136. æKY kAEBooleanType
  1137. æFp AppleEvents.p
  1138. æT CONST
  1139. æD kAEBooleanType = 'bool';
  1140. æC 
  1141.  
  1142. æKY kAETrueType
  1143. æFp AppleEvents.p
  1144. æT CONST
  1145. æD kAETrueType = 'true';
  1146. æC 
  1147.  
  1148. æKY kAEFalseType
  1149. æFp AppleEvents.p
  1150. æT CONST
  1151. æD kAEFalseType = 'fals';
  1152. æC 
  1153.  
  1154. æKY kAEAliasType
  1155. æFp AppleEvents.p
  1156. æT CONST
  1157. æD kAEAliasType = 'alis';
  1158. æC 
  1159.  
  1160. æKY kAEDirectObjectKeyword
  1161. æFp AppleEvents.p
  1162. æT CONST
  1163. æD kAEDirectObjectKeyword = '----';
  1164. æC 
  1165.  
  1166. æKY kCoreEventClass
  1167. æFp AppleEvents.p
  1168. æT CONST
  1169. æD kCoreEventClass = 'aevt';
  1170. æC 
  1171.  
  1172. æKY kAEOpenApplication
  1173. æFp AppleEvents.p
  1174. æT CONST
  1175. æD kAEOpenApplication = 'oapp';
  1176. æC 
  1177.  
  1178. æKY kAEOpenDocuments
  1179. æFp AppleEvents.p
  1180. æT CONST
  1181. æD kAEOpenDocuments = 'odoc';
  1182. æC 
  1183.  
  1184. æKY kAEPrintDocuments
  1185. æFp AppleEvents.p
  1186. æT CONST
  1187. æD kAEPrintDocuments = 'pdoc';
  1188. æC 
  1189.  
  1190. æKY kAEQuitApplication
  1191. æFp AppleEvents.p
  1192. æT CONST
  1193. æD kAEQuitApplication = 'quit';
  1194. æC 
  1195.  
  1196. æKY kAENoReply
  1197. æFp AppleEvents.p
  1198. æT CONST
  1199. æD kAENoReply = $00000001; { Sender doesn't want a reply to event }
  1200. æC 
  1201.  
  1202. æKY kAEQueueReply
  1203. æFp AppleEvents.p
  1204. æT CONST
  1205. æD kAEQueueReply = $00000002; { Sender wants a reply but won't wait }
  1206. æC 
  1207.  
  1208. æKY kAEWaitReply
  1209. æFp AppleEvents.p
  1210. æT CONST
  1211. æD kAEWaitReply = $00000003; { Sender wants a reply and will be waiting }
  1212. æC 
  1213.  
  1214. æKY kAENeverInteract
  1215. æFp AppleEvents.p
  1216. æT CONST
  1217. æD kAENeverInteract = $00000010; { Server should not interact with user }
  1218. æC 
  1219.  
  1220. æKY kAECanInteract
  1221. æFp AppleEvents.p
  1222. æT CONST
  1223. æD kAECanInteract = $00000020; { Server may try to interact with user }
  1224. æC 
  1225.  
  1226. æKY kAEAlwaysInteract
  1227. æFp AppleEvents.p
  1228. æT CONST
  1229. æD kAEAlwaysInteract = $00000030; { Server should always interact with user }
  1230. æC 
  1231.  
  1232. æKY kAECanSwitchLayer
  1233. æFp AppleEvents.p
  1234. æT CONST
  1235. æD kAECanSwitchLayer = $00000040; { Interaction may switch layer }
  1236. æC 
  1237.  
  1238. æKY kAEDontReconnect
  1239. æFp AppleEvents.p
  1240. æT CONST
  1241. æD kAEDontReconnect = $00000080; { don't reconnect if there is a sessClosedErr }
  1242. æC 
  1243.  
  1244. æKY kAEWantReceipt
  1245. æFp AppleEvents.p
  1246. æT CONST
  1247. æD kAEWantReceipt = nReturnReceipt; { Send wants a receipt of message }
  1248. æC 
  1249.  
  1250. æKY kAENormalPriority
  1251. æFp AppleEvents.p
  1252. æT CONST
  1253. æD kAENormalPriority = $00000000; { Post message at the end of event queue }
  1254. æC 
  1255.  
  1256. æKY kAEHighPriority
  1257. æFp AppleEvents.p
  1258. æT CONST
  1259. æD kAEHighPriority = nAttnMsg; { Post message at the front of the event queue }
  1260. æC 
  1261.  
  1262. æKY kAutoGenerateRefcon
  1263. æFp AppleEvents.p
  1264. æT CONST
  1265. æD kAutoGenerateRefcon = 0;
  1266. æC 
  1267.  
  1268. æKY kAEEventNotInTable
  1269. æFp AppleEvents.p
  1270. æT CONST
  1271. æD kAEEventNotInTable = 0; { Passed to the general dispatch proc if the 
  1272.    event received was not in the dispatch table }
  1273. æC 
  1274.  
  1275. æKY kAECoercionFail
  1276. æFp AppleEvents.p
  1277. æT CONST
  1278. æD 
  1279. { Error messages in response to reading and writing buffer contents }
  1280.  
  1281. kAECoercionFail = -1700;
  1282. æC 
  1283.  
  1284. æKY kAEDescNotFound
  1285. æFp AppleEvents.p
  1286. æT CONST
  1287. æD kAEDescNotFound = -1701;
  1288. æC 
  1289.  
  1290. æKY kAECorruptData
  1291. æFp AppleEvents.p
  1292. æT CONST
  1293. æD kAECorruptData = -1702;
  1294. æC 
  1295.  
  1296. æKY kAEWrongDataType
  1297. æFp AppleEvents.p
  1298. æT CONST
  1299. æD kAEWrongDataType = -1703;
  1300. æC 
  1301.  
  1302. æKY kAENotAEList
  1303. æFp AppleEvents.p
  1304. æT CONST
  1305. æD kAENotAEList = -1704;
  1306. æC 
  1307.  
  1308. æKY kAEBadListElement
  1309. æFp AppleEvents.p
  1310. æT CONST
  1311. æD kAEBadListElement = -1705;
  1312. æC 
  1313.  
  1314. æKY kAEWrongVersion
  1315. æFp AppleEvents.p
  1316. æT CONST
  1317. æD kAEWrongVersion = -1706;
  1318. æC 
  1319.  
  1320. æKY kAENotAppleEvent
  1321. æFp AppleEvents.p
  1322. æT CONST
  1323. æD kAENotAppleEvent = -1707;
  1324. æC 
  1325.  
  1326. æKY kAEEventNotFound
  1327. æFp AppleEvents.p
  1328. æT CONST
  1329. æD 
  1330. { Error messages in response to sending/receiving a message }
  1331.  
  1332. kAEEventNotFound = -1708; { The event isn't in the supplied event table }
  1333. æC 
  1334.  
  1335. æKY kAEReplyNotValid
  1336. æFp AppleEvents.p
  1337. æT CONST
  1338. æD kAEReplyNotValid = -1709; { AEResetTimer was passed an invalid reply }
  1339. æC 
  1340.  
  1341. æKY kAEUnknownSendMode
  1342. æFp AppleEvents.p
  1343. æT CONST
  1344. æD kAEUnknownSendMode = -1710; { Mode wasn't NoReply, WaitReply, QueueReply;
  1345.    or Interaction level is unknown }
  1346. æC 
  1347.  
  1348. æKY KAEWaitCanceled
  1349. æFp AppleEvents.p
  1350. æT CONST
  1351. æD KAEWaitCanceled = -1711; { User cancelled out of wait loop for reply
  1352.    or receipt }
  1353. æC 
  1354.  
  1355. æKY kAETimeoutErr
  1356. æFp AppleEvents.p
  1357. æT CONST
  1358. æD kAETimeoutErr = -1712; { AppleEvent time out }
  1359. æC 
  1360.  
  1361. æKY kAENoUserInteraction
  1362. æFp AppleEvents.p
  1363. æT CONST
  1364. æD kAENoUserInteraction = -1713; { no user interaction allowed }
  1365. æC 
  1366.  
  1367. æKY AEArrayType
  1368. kAEDataArray
  1369. kAEPackedArray
  1370. kAEHandleArray
  1371. kAEDescArray
  1372. kAEKeyDescArray
  1373. æFp AppleEvents.p
  1374. æT TYPE
  1375. æD AEArrayType = (kAEDataArray,kAEPackedArray,kAEHandleArray,kAEDescArray,
  1376.     kAEKeyDescArray);
  1377. æC 
  1378.  
  1379. æKY AEInteractAllowed
  1380. kAEUnknownInteract
  1381. kAEInteractionWithSelf
  1382. kAEInteractWithLocal
  1383. kAEInteractWithAll
  1384.  
  1385. æFp AppleEvents.p
  1386. æT TYPE
  1387. æD AEInteractAllowed = (kAEUnknownInteract,kAEInteractionWithSelf,kAEInteractWithLocal,
  1388.     kAEInteractWithAll);
  1389. æC 
  1390.  
  1391. æKY AEAddress
  1392. AEAddressPtr
  1393. AEAddressHndl
  1394. æFp AppleEvents.p
  1395. æT RECORD
  1396. æD AEAddressPtr = ^AEAddress;
  1397. AEAddressHndl = ^AEAddressPtr;
  1398. AEAddress = RECORD
  1399.     CASE addressKind: LONGINT OF
  1400.       receiverIDisPSN:
  1401.         (receiverIDasPSN: ProcessSerialNumber);
  1402.       receiverIDisSignature:
  1403.         (receiverIDasSig: OSType);
  1404.       receiverIDisSessionID:
  1405.         (receiverIDasSess: LONGINT);
  1406.       receiverIDisTargetID:
  1407.         (receiverIDasTargetID: TargetID);
  1408.     END;
  1409. æC 
  1410.  
  1411. æKY AEDesc
  1412. æFp AppleEvents.p
  1413. æT RECORD
  1414. æD AEDesc = RECORD
  1415.     descriptorType: DescType;
  1416.     CASE BOOLEAN OF
  1417.       false:
  1418.         (asDataHdl: Handle);
  1419.       true:
  1420.         (asAEList: AEList);
  1421.     END;
  1422. æC 
  1423.  
  1424. æKY AEKeyDesc
  1425. æFp AppleEvents.p
  1426. æT RECORD
  1427. æD AEKeyDesc = RECORD
  1428.     descKey: KeyWord;
  1429.     descContent: AEDesc;
  1430.     END;
  1431. æC 
  1432.  
  1433. æKY AEInit
  1434. æFp AppleEvents.p
  1435. æT FUNCTION
  1436. æD FUNCTION AEInit(dispatchProc: ProcPtr;coercionProc: ProcPtr;nonAevtHandler:
  1437.    ProcPtr): OSErr;
  1438. æDT myVariable := AEInit(dispatchProc,coercionProc,nonAevtHandler);
  1439. æC 
  1440.  
  1441. æKY AEQuit
  1442. æFp AppleEvents.p
  1443. æT PROCEDURE
  1444. æD PROCEDURE AEQuit;
  1445. æDT AEQuit;
  1446. æC 
  1447.  
  1448.  
  1449. æKY AEPutPtr
  1450. æFp AppleEvents.p
  1451. æT FUNCTION
  1452. æD FUNCTION AEPutPtr(theList: AEList;index: LONGINT;typeCode: DescType;dataPtr: Ptr;
  1453.     dataSize: LONGINT): OSErr;
  1454. æDT myVariable := AEPutPtr(theList,index,typeCode,dataPtr,dataSize);
  1455. æC 
  1456.  
  1457. æKY AEPutDesc
  1458. æFp AppleEvents.p
  1459. æT FUNCTION
  1460. æD FUNCTION AEPutDesc(theList: AEList;index: LONGINT;theDesc: AEDesc): OSErr;
  1461. æDT myVariable := AEPutDesc(theList,index,theDesc);
  1462. æC 
  1463.  
  1464. æKY AEPutKeyPtr
  1465. æFp AppleEvents.p
  1466. æT FUNCTION
  1467. æD FUNCTION AEPutKeyPtr(theList: AEList;key: KeyWord;typeCode: DescType;dataPtr: Ptr;
  1468.     dataSize: LONGINT): OSErr;
  1469. æDT myVariable := AEPutKeyPtr(theList,key,typeCode,dataPtr,dataSize);
  1470. æC 
  1471.  
  1472. æKY AEPutKeyDesc
  1473. æFp AppleEvents.p
  1474. æT FUNCTION
  1475. æD FUNCTION AEPutKeyDesc(theList: AEList;key: KeyWord;theDesc: AEDesc): OSErr;
  1476. æDT myVariable := AEPutKeyDesc(theList,key,theDesc);
  1477. æC 
  1478.  
  1479. æKY AEGetNthPtr
  1480. æFp AppleEvents.p
  1481. æT FUNCTION
  1482. æD FUNCTION AEGetNthPtr(theList: AEList;index: LONGINT;desiredType: DescType;
  1483.     VAR key: KeyWord;VAR typeCode: DescType;dataPtr: Ptr;maxSize: LONGINT;
  1484.     VAR actualSize: LONGINT): OSErr;
  1485. æDT myVariable := AEGetNthPtr(theList,index,desiredType,key,typeCode,dataPtr,
  1486.       maxSize,actualSize);
  1487. æC 
  1488.  
  1489. æKY AEGetNthDesc
  1490. æFp AppleEvents.p
  1491. æT FUNCTION
  1492. æD FUNCTION AEGetNthDesc(theList: AEList;index: LONGINT;desiredType: DescType;
  1493.     VAR key: KeyWord;VAR theDesc: AEDesc): OSErr;
  1494. æDT myVariable := AEGetNthDesc(theList,index,desiredType,key,theDesc);
  1495. æC 
  1496.  
  1497. æKY AEGetKeyPtr
  1498. æFp AppleEvents.p
  1499. æT FUNCTION
  1500. æD FUNCTION AEGetKeyPtr(theList: AEList;key: KeyWord;desiredType: DescType;
  1501.     VAR typeCode: DescType;dataPtr: Ptr;maxSize: LONGINT;VAR actualSize: LONGINT): OSErr;
  1502. æDT myVariable := AEGetKeyPtr(theList,key,desiredType,typeCode,dataPtr,maxSize,actualSize);
  1503. æC 
  1504.  
  1505. æKY AEGetKeyDesc
  1506. æFp AppleEvents.p
  1507. æT FUNCTION
  1508. æD FUNCTION AEGetKeyDesc(theList: AEList;key: KeyWord;desiredType: DescType;
  1509.     VAR theDesc: AEDesc): OSErr;
  1510. æDT myVariable := AEGetKeyDesc(theList,key,desiredType,theDesc);
  1511. æC 
  1512.  
  1513. æKY AEGetArray
  1514. æFp AppleEvents.p
  1515. æT FUNCTION
  1516. æD FUNCTION AEGetArray(theList: AEList;arrayType: AEArrayType;arrayPtr: Ptr;
  1517.     bufSize: LONGINT;VAR elemType: DescType;VAR elemSize: LONGINT;VAR itemCount: LONGINT): OSErr;
  1518. æDT myVariable := AEGetArray(theList,arrayType,arrayPtr,bufSize,elemType,elemSize,itemCount);
  1519. æC 
  1520.  
  1521. æKY AEPutArray
  1522. æFp AppleEvents.p
  1523. æT FUNCTION
  1524. æD FUNCTION AEPutArray(theList: AEList;arrayType: AEArrayType;arrayPtr: Ptr;
  1525.     elemType: DescType;elemSize: LONGINT;itemCount: LONGINT): OSErr;
  1526. æDT myVariable := AEPutArray(theList,arrayType,arrayPtr,elemType,elemSize,itemCount);
  1527. æC
  1528.  
  1529.  
  1530. æKY AEDeleteIndex
  1531. æFp AppleEvents.p
  1532. æT FUNCTION
  1533. æD FUNCTION AEDeleteIndex(theList: AEList;index: LONGINT): OSErr;
  1534. æDT myVariable := AEDeleteIndex(theList,index);
  1535. æC 
  1536.  
  1537. æKY AEDeleteKey
  1538. æFp AppleEvents.p
  1539. æT FUNCTION
  1540. æD FUNCTION AEDeleteKey(theList: AEList;key: KeyWord): OSErr;
  1541. æDT myVariable := AEDeleteKey(theList,key);
  1542. æC 
  1543.  
  1544. æKY AECoerceDesc
  1545. æFp AppleEvents.p
  1546. æT FUNCTION
  1547. æD FUNCTION AECoerceDesc(desc: AEDesc;toType: DescType;VAR result: AEDesc): OSErr;
  1548. æDT myVariable := AECoerceDesc(desc,toType,result);
  1549. æC 
  1550.  
  1551. æKY AEDisposeAEList
  1552. æFp AppleEvents.p
  1553. æT PROCEDURE
  1554. æD PROCEDURE AEDisposeAEList(theArg: AEList);
  1555. æDT AEDisposeAEList(theArg);
  1556. æC 
  1557.  
  1558. æKY AEDisposeAEDesc
  1559. æFp AppleEvents.p
  1560. æT PROCEDURE
  1561. æD PROCEDURE AEDisposeAEDesc(theArg: AEDesc);
  1562. æDT AEDisposeAEDesc(theArg);
  1563. æC 
  1564.  
  1565. æKY AECreateAevt
  1566. æFp AppleEvents.p
  1567. æT FUNCTION
  1568. æD FUNCTION AECreateAevt(theEventClass: EventClass;theEventID: EventID;target: AEAdress;
  1569.     theRefCon: LONGINT;VAR result: AEList): OSErr;
  1570. æDT myVariable := AECreateAevt(theEventClass,theEventID,target,theRefCon,result);
  1571. æC 
  1572.  
  1573. æKY AEGetEventClassAndID
  1574. æFp AppleEvents.p
  1575. æT PROCEDURE
  1576. æD 
  1577. {  Extract the event class and id from the specified message  }
  1578. PROCEDURE AEGetEventClassAndID(theAevt: AEList;VAR theEventClass: EventClass;
  1579.     VAR theEventID: EventID);
  1580. æDT AEGetEventClassAndID(theAevt,theEventClass,theEventID);
  1581. æC 
  1582.  
  1583. æKY AEGetRefCon
  1584. æFp AppleEvents.p
  1585. æT PROCEDURE
  1586. æD 
  1587. {  Extract the event class and id from the specified message  }
  1588. PROCEDURE AEGetRefCon(theAevt: AEList;VAR refCon: LONGINT);
  1589. æDT AEGetRefCon(theAevt,refCon);
  1590. æC 
  1591.  
  1592. æKY AEGetAddress
  1593. æFp AppleEvents.p
  1594. æT PROCEDURE
  1595. æD 
  1596. {  Extract the address from the specified message  }
  1597. PROCEDURE AEGetAddress(theAevt: AEList;VAR address: AEAddress);
  1598. æDT AEGetAddress(theAevt,address);
  1599. æC 
  1600.  
  1601. æKY AECreateList
  1602. æFp AppleEvents.p
  1603. æT FUNCTION
  1604. æD FUNCTION AECreateList(factoringPtr: Ptr;factoredSize: LONGINT;isRecord: BOOLEAN;
  1605.     VAR resultList: AEDesc): OSErr;
  1606. æDT myVariable := AECreateList(factoringPtr,factoredSize,isRecord,resultList);
  1607. æC 
  1608.  
  1609. æKY AECountListElems
  1610. æFp AppleEvents.p
  1611. æT FUNCTION
  1612. æD FUNCTION AECountListElems(theList: AEList): LONGINT;
  1613. æDT myVariable := AECountListElems(theList);
  1614. æC 
  1615.  
  1616. æKY AESend
  1617. æFp AppleEvents.p
  1618. æT FUNCTION
  1619. æD FUNCTION AESend(theList: AEList;VAR theReply: AEList;sendMode: LONGINT;
  1620.     sendPriority: INTEGER;timeOut: LONGINT;idleProc: ProcPtr): OSErr;
  1621. æDT myVariable := AESend(theList,theReply,sendMode,sendPriority,timeOut,idleProc);
  1622. æC 
  1623.  
  1624. æKY AEResetTimer
  1625. æFp AppleEvents.p
  1626. æT FUNCTION
  1627. æD 
  1628. {  Convience routine.  Create and send a 'wait' message from the information in the reply.  }
  1629. FUNCTION AEResetTimer(reply: AEList): OSErr;
  1630. æDT myVariable := AEResetTimer(reply);
  1631. æC 
  1632.  
  1633. æKY AESetAddressByPSN
  1634. æFp AppleEvents.p
  1635. æT PROCEDURE
  1636. æD 
  1637. {  Fill theAddressObject as receiverIDisPSN  }
  1638. PROCEDURE AESetAddressByPSN(thePSN: ProcessSerialNumber;VAR theAddress: AEAdress);
  1639. æDT AESetAddressByPSN(thePSN,theAddress);
  1640. æC
  1641.  
  1642. æKY AESetAddressBySignature
  1643. æFp AppleEvents.p
  1644. æT PROCEDURE
  1645. æD 
  1646. {  Fill theAddressObject as receiverIDisSignature  }
  1647. PROCEDURE AESetAddressBySignature(theSig: OSType;VAR theAddress: AEAddress);
  1648. æDT AESetAddressBySignature(theSig,theAddress);
  1649. æC 
  1650.  
  1651. æKY AESetAddressBySessionID
  1652. æFp AppleEvents.p
  1653. æT PROCEDURE
  1654. æD 
  1655. {  Fill theAddressObject as receiverIDisSessionID  }
  1656. PROCEDURE AESetAddressBySessionID(theSessionID: LONGINT;VAR theAddress: AEAddress);
  1657. æDT AESetAddressBySessionID(theSessionID,theAddress);
  1658. æC 
  1659.  
  1660. æKY AESetAddressByTargetID
  1661. æFp AppleEvents.p
  1662. æT PROCEDURE
  1663. æD 
  1664. {  Fill theAddressObject as receiverIDisTargetID  }
  1665. PROCEDURE AESetAddressByTargetID(theTargetID: TargetID;VAR theAddress: AEAddress);
  1666. æDT AESetAddressByTargetID(theTargetID,theAddress);
  1667. æC 
  1668.  
  1669. æKY AEProcessAppleEvent
  1670. æFp AppleEvents.p
  1671. æT FUNCTION
  1672. æD FUNCTION AEProcessAppleEvent(eventRec: EventRecord): OSErr;
  1673. æDT myVariable := AEProcessAppleEvent(eventRec);
  1674. æC 
  1675.  
  1676. æKY AEGetDispatchTableRsrc
  1677. æFp AppleEvents.p
  1678. æT FUNCTION
  1679. æD 
  1680. {  Load an event table from a 'AEDF' resource.  This of course will only be    of
  1681.    use to applications using a general dispatch routine rather than doing a
  1682.    direct dispatch to a handler.  }
  1683. FUNCTION AEGetDispatchTableRsrc(tableID: INTEGER): OSErr;
  1684. æDT myVariable := AEGetDispatchTableRsrc(tableID);
  1685. æC the specified string is drawn.
  1686.  
  1687.  
  1688. æKY AECreateDispatchTable
  1689. æFp AppleEvents.p
  1690. æT FUNCTION
  1691. æD 
  1692. {  Create an event table with one memory manager call for the number of events
  1693.    specified.  If more events are added to the table with AESetupEventTable,
  1694.    the table will be grown automatically.  }
  1695. FUNCTION AECreateDispatchTable(numEntries: INTEGER): OSErr;
  1696. æDT myVariable := AECreateDispatchTable(numEntries);
  1697. æC 
  1698.  
  1699. æKY AEAddEvtToTable
  1700. æFp AppleEvents.p
  1701. æT FUNCTION
  1702. æD 
  1703. {  Add a single event to the table, expanding if necessary.  }
  1704. FUNCTION AEAddEvtToTable(theEventClass: EventClass;theEventID: EventID;
  1705.     value: LONGINT): OSErr;
  1706. æDT myVariable := AEAddEvtToTable(theEventClass,theEventID,value);
  1707. æC 
  1708.  
  1709. æKY AEGetTableEntry
  1710. æFp AppleEvents.p
  1711. æT FUNCTION
  1712. æD 
  1713. {  returns the value of the specified event in theValue. kAEEventNotFound if not found.  }
  1714. FUNCTION AEGetTableEntry(theEventClass: EventClass;theEventID: EventID;
  1715.     VAR theValue: LONGINT): OSErr;
  1716. æDT myVariable := AEGetTableEntry(theEventClass,theEventID,theValue);
  1717. æC
  1718.  
  1719. æKY AEInteractWithUser
  1720. æFp AppleEvents.p
  1721. æT FUNCTION
  1722. æD FUNCTION AEInteractWithUser(timeOut: LONGINT;nmReqPtr: QElemPtr): OSErr;
  1723. æDT myVariable := AEInteractWithUser(timeOut,nmReqPtr);
  1724. æC 
  1725.  
  1726. æKY AEGetInteractLevel
  1727. æFp AppleEvents.p
  1728. æT FUNCTION
  1729. æD 
  1730. {  returns kAENeverInteract, kAECanInteract or kAEAlwaysInteract  }
  1731. FUNCTION AEGetInteractLevel(theAevt: AEList): INTEGER;
  1732. æDT myVariable := AEGetInteractLevel(theAevt);
  1733. æC 
  1734.  
  1735. æKY AEInteractionAllowed
  1736. æFp AppleEvents.p
  1737. æT FUNCTION
  1738. æD FUNCTION AEInteractionAllowed(theLevel: AEInteractAllowed): AEInteractAllowed;
  1739. æDT myVariable := AEInteractionAllowed(theLevel);
  1740. æC 
  1741.  
  1742. æKY AEWhichAevt
  1743. æFp AppleEvents.p
  1744. æT FUNCTION
  1745. æD FUNCTION AEWhichAevt: AEList;
  1746. æDT myVariable := AEWhichAevt;
  1747. æC 
  1748.  
  1749.  
  1750. æKY AppleTalk.p
  1751. æKL AFPCommand
  1752. ASPAbortOS
  1753. ASPCloseAll
  1754. ASPCloseSession
  1755. ASPGetParms
  1756. ASPGetStatus
  1757. ASPOpenSession
  1758. ASPUserCommand
  1759. ASPUserWrite
  1760. ATPAddRsp
  1761. ATPCloseSocket
  1762. ATPGetRequest
  1763. ATPLoad
  1764. ATPOpenSocket
  1765. ATPReqCancel
  1766. ATPRequest
  1767. ATPResponse
  1768. ATPRspCancel
  1769. ATPSndRequest
  1770. ATPSndRsp
  1771. ATPUnload
  1772. BuildBDS
  1773. BuildDDPwds
  1774. BuildLAPwds
  1775. DDPCloseSocket
  1776. DDPOpenSocket
  1777. DDPRdCancel
  1778. DDPRead
  1779. DDPWrite
  1780. GetBridgeAddress
  1781. GetLocalZones
  1782. GetMyZone
  1783. GetNodeAddress
  1784. GetZoneList
  1785. IsATPOpen
  1786. IsMPPOpen
  1787. LAPCloseProtocol
  1788. LAPOpenProtocol
  1789. LAPRdCancel
  1790. LAPRead
  1791. LAPWrite
  1792. MPPClose
  1793. MPPOpen
  1794. NBPConfirm
  1795. NBPExtract
  1796. NBPLoad
  1797. NBPLookup
  1798. NBPRegister
  1799. NBPRemove
  1800. NBPSetEntity
  1801. NBPSetNTE
  1802. NBPUnload
  1803. OpenXPP
  1804. PAddResponse
  1805. PATalkClosePrep
  1806. PAttachPH
  1807. PCancelATalkClosePrep
  1808. PCloseATPSkt
  1809. PCloseSkt
  1810. PConfirmName
  1811. PDetachPH
  1812. PGetAppleTalkInfo
  1813. PGetRequest
  1814. PKillAllGetReq
  1815. PKillGetReq
  1816. PKillNBP
  1817. PKillSendReq
  1818. PLookupName
  1819. PNSendRequest
  1820. POpenATPSkt
  1821. POpenSkt
  1822. PRegisterName
  1823. PRelRspCB
  1824. PRelTCB
  1825. PRemoveName
  1826. PSendRequest
  1827. PSendResponse
  1828. PSetSelfSend
  1829. PWriteDDP
  1830. PWriteLAP
  1831. RemoveHdlBlocks
  1832.  
  1833. ABByte
  1834. ABCallType
  1835. ABProtoType
  1836. ABRecHandle
  1837. ABRecPtr
  1838. ABusRecord
  1839. AddrBlock
  1840. afpAddAPPL
  1841. afpAddCmt
  1842. afpAddIcon
  1843. afpByteRangeLock
  1844. AFPCommandBlock
  1845. afpContLogin
  1846. afpCopyFile
  1847. afpDelete
  1848. afpDirClose
  1849. afpDirCreate
  1850. afpDTClose
  1851. afpDTOpen
  1852. afpEnumerate
  1853. afpFileCreate
  1854. afpFlush
  1855. afpForkClose
  1856. afpForkFlush
  1857. afpGetAPPL
  1858. afpGetCmt
  1859. afpGetDirParms
  1860. afpGetFileParms
  1861. afpGetFlDrParms
  1862. afpGetForkParms
  1863. afpGetIcon
  1864. afpGetSInfo
  1865. afpGetSParms
  1866. afpGetVolParms
  1867. afpGtIcnInfo
  1868. afpLogin
  1869. afpLogout
  1870. afpMapID
  1871. afpMapName
  1872. afpMove
  1873. afpOpenDir
  1874. afpOpenFork
  1875. afpOpenVol
  1876. afpRead
  1877. afpRename
  1878. afpRmvAPPL
  1879. afpRmvCmt
  1880. afpSetDirParms
  1881. afpSetFileParms
  1882. afpSetFlDrParms
  1883. afpSetForkParms
  1884. afpSetVolParms
  1885. afpVolClose
  1886. afpWrite
  1887. atpEOMvalue
  1888. ATPParamBlock
  1889. ATPPBPtr
  1890. atpProto
  1891. atpSendChkvalue
  1892. atpSize
  1893. atpSTSvalue
  1894. atpTIDValidvalue
  1895. atpXOvalue
  1896. ATQEntry
  1897. BDSElement
  1898. BDSPtr
  1899. BDSType
  1900. BitMapType
  1901. ddpProto
  1902. ddpSize
  1903. EntityName
  1904. EntityPtr
  1905. LAPAdrBlock
  1906. LAPMgrCall
  1907. LAPMgrPtr
  1908. lapProto
  1909. lapSize
  1910. MPPParamBlock
  1911. MPPParmType
  1912. MPPPBPtr
  1913. NamesTableEntry
  1914. nbpProto
  1915. nbpSize
  1916. RetransType
  1917. scbMemSize
  1918. Str32
  1919. tATPAddRsp
  1920. tATPGetRequest
  1921. tATPRequest
  1922. tATPResponse
  1923. tATPSdRsp
  1924. tATPSndRequest
  1925. tDDPRead
  1926. tDDPWrite
  1927. tLAPRead
  1928. tLAPWrite
  1929. tNBPConfirm
  1930. tNBPLookup
  1931. tNBPRegister
  1932. WDSElement
  1933. XPPEndPrmType
  1934. xppFlagClr
  1935. xppFlagSet
  1936. xppLoadedBit
  1937. XPPParamBlock
  1938. XPPParmBlkPtr
  1939. XPPPrmBlkType
  1940. xppRefNum
  1941. XPPSubPrmType
  1942. xppUnitNum
  1943.  
  1944. æKY afpByteRangeLock
  1945. æFp AppleTalk.p
  1946. æT CONST
  1947. æD afpByteRangeLock = 1; {AFPCall command codes}
  1948. æC 
  1949.  
  1950. æKY afpVolClose
  1951. æFp AppleTalk.p
  1952. æT CONST
  1953. æD afpVolClose = 2; {AFPCall command codes}
  1954. æC 
  1955.  
  1956. æKY afpDirClose
  1957. æFp AppleTalk.p
  1958. æT CONST
  1959. æD afpDirClose = 3; {AFPCall command codes}
  1960. æC 
  1961.  
  1962. æKY afpForkClose
  1963. æFp AppleTalk.p
  1964. æT CONST
  1965. æD afpForkClose = 4; {AFPCall command codes}
  1966. æC 
  1967.  
  1968. æKY afpCopyFile
  1969. æFp AppleTalk.p
  1970. æT CONST
  1971. æD afpCopyFile = 5; {AFPCall command codes}
  1972. æC 
  1973.  
  1974. æKY afpDirCreate
  1975. æFp AppleTalk.p
  1976. æT CONST
  1977. æD afpDirCreate = 6; {AFPCall command codes}
  1978. æC 
  1979.  
  1980. æKY afpFileCreate
  1981. æFp AppleTalk.p
  1982. æT CONST
  1983. æD afpFileCreate = 7; {AFPCall command codes}
  1984. æC 
  1985.  
  1986. æKY afpDelete
  1987. æFp AppleTalk.p
  1988. æT CONST
  1989. æD afpDelete = 8; {AFPCall command codes}
  1990. æC 
  1991.  
  1992. æKY afpEnumerate
  1993. æFp AppleTalk.p
  1994. æT CONST
  1995. æD afpEnumerate = 9; {AFPCall command codes}
  1996. æC 
  1997.  
  1998. æKY afpFlush
  1999. æFp AppleTalk.p
  2000. æT CONST
  2001. æD afpFlush = 10; {AFPCall command codes}
  2002. æC 
  2003.  
  2004. æKY afpForkFlush
  2005. æFp AppleTalk.p
  2006. æT CONST
  2007. æD afpForkFlush = 11; {AFPCall command codes}
  2008. æC 
  2009.  
  2010. æKY afpGetDirParms
  2011. æFp AppleTalk.p
  2012. æT CONST
  2013. æD afpGetDirParms = 12; {AFPCall command codes}
  2014. æC 
  2015.  
  2016. æKY afpGetFileParms
  2017. æFp AppleTalk.p
  2018. æT CONST
  2019. æD afpGetFileParms = 13; {AFPCall command codes}
  2020. æC 
  2021.  
  2022. æKY afpGetForkParms
  2023. æFp AppleTalk.p
  2024. æT CONST
  2025. æD afpGetForkParms = 14; {AFPCall command codes}
  2026. æC 
  2027.  
  2028. æKY afpGetSInfo
  2029. æFp AppleTalk.p
  2030. æT CONST
  2031. æD afpGetSInfo = 15; {AFPCall command codes}
  2032. æC 
  2033.  
  2034. æKY afpGetSParms
  2035. æFp AppleTalk.p
  2036. æT CONST
  2037. æD afpGetSParms = 16; {AFPCall command codes}
  2038. æC 
  2039.  
  2040. æKY afpGetVolParms
  2041. æFp AppleTalk.p
  2042. æT CONST
  2043. æD afpGetVolParms = 17; {AFPCall command codes}
  2044. æC 
  2045.  
  2046. æKY afpLogin
  2047. æFp AppleTalk.p
  2048. æT CONST
  2049. æD afpLogin = 18; {AFPCall command codes}
  2050. æC 
  2051.  
  2052. æKY afpContLogin
  2053. æFp AppleTalk.p
  2054. æT CONST
  2055. æD afpContLogin = 19; {AFPCall command codes}
  2056. æC 
  2057.  
  2058. æKY afpLogout
  2059. æFp AppleTalk.p
  2060. æT CONST
  2061. æD afpLogout = 20; {AFPCall command codes}
  2062. æC 
  2063.  
  2064. æKY afpMapID
  2065. æFp AppleTalk.p
  2066. æT CONST
  2067. æD afpMapID = 21; {AFPCall command codes}
  2068. æC 
  2069.  
  2070. æKY afpMapName
  2071. æFp AppleTalk.p
  2072. æT CONST
  2073. æD afpMapName = 22; {AFPCall command codes}
  2074. æC 
  2075.  
  2076. æKY afpMove
  2077. æFp AppleTalk.p
  2078. æT CONST
  2079. æD afpMove = 23; {AFPCall command codes}
  2080. æC 
  2081.  
  2082. æKY afpOpenVol
  2083. æFp AppleTalk.p
  2084. æT CONST
  2085. æD afpOpenVol = 24; {AFPCall command codes}
  2086. æC 
  2087.  
  2088. æKY afpOpenDir
  2089. æFp AppleTalk.p
  2090. æT CONST
  2091. æD afpOpenDir = 25; {AFPCall command codes}
  2092. æC 
  2093.  
  2094. æKY afpOpenFork
  2095. æFp AppleTalk.p
  2096. æT CONST
  2097. æD afpOpenFork = 26; {AFPCall command codes}
  2098. æC 
  2099.  
  2100. æKY afpRead
  2101. æFp AppleTalk.p
  2102. æT CONST
  2103. æD afpRead = 27; {AFPCall command codes}
  2104. æC 
  2105.  
  2106. æKY afpRename
  2107. æFp AppleTalk.p
  2108. æT CONST
  2109. æD afpRename = 28; {AFPCall command codes}
  2110. æC 
  2111.  
  2112. æKY afpSetDirParms
  2113. æFp AppleTalk.p
  2114. æT CONST
  2115. æD afpSetDirParms = 29; {AFPCall command codes}
  2116. æC 
  2117.  
  2118. æKY afpSetFileParms
  2119. æFp AppleTalk.p
  2120. æT CONST
  2121. æD afpSetFileParms = 30; {AFPCall command codes}
  2122. æC 
  2123.  
  2124. æKY afpSetForkParms
  2125. æFp AppleTalk.p
  2126. æT CONST
  2127. æD afpSetForkParms = 31; {AFPCall command codes}
  2128. æC 
  2129.  
  2130. æKY afpSetVolParms
  2131. æFp AppleTalk.p
  2132. æT CONST
  2133. æD afpSetVolParms = 32; {AFPCall command codes}
  2134. æC 
  2135.  
  2136. æKY afpWrite
  2137. æFp AppleTalk.p
  2138. æT CONST
  2139. æD afpWrite = 33; {AFPCall command codes}
  2140. æC 
  2141.  
  2142. æKY afpGetFlDrParms
  2143. æFp AppleTalk.p
  2144. æT CONST
  2145. æD afpGetFlDrParms = 34; {AFPCall command codes}
  2146. æC 
  2147.  
  2148. æKY afpSetFlDrParms
  2149. æFp AppleTalk.p
  2150. æT CONST
  2151. æD afpSetFlDrParms = 35; {AFPCall command codes}
  2152. æC 
  2153.  
  2154. æKY afpDTOpen
  2155. æFp AppleTalk.p
  2156. æT CONST
  2157. æD afpDTOpen = 48; {AFPCall command codes}
  2158. æC 
  2159.  
  2160. æKY afpDTClose
  2161. æFp AppleTalk.p
  2162. æT CONST
  2163. æD afpDTClose = 49; {AFPCall command codes}
  2164. æC 
  2165.  
  2166. æKY afpGetIcon
  2167. æFp AppleTalk.p
  2168. æT CONST
  2169. æD afpGetIcon = 51; {AFPCall command codes}
  2170. æC 
  2171.  
  2172. æKY afpGtIcnInfo
  2173. æFp AppleTalk.p
  2174. æT CONST
  2175. æD afpGtIcnInfo = 52; {AFPCall command codes}
  2176. æC 
  2177.  
  2178. æKY afpAddAPPL
  2179. æFp AppleTalk.p
  2180. æT CONST
  2181. æD afpAddAPPL = 53; {AFPCall command codes}
  2182. æC 
  2183.  
  2184. æKY afpRmvAPPL
  2185. æFp AppleTalk.p
  2186. æT CONST
  2187. æD afpRmvAPPL = 54; {AFPCall command codes}
  2188. æC 
  2189.  
  2190. æKY afpGetAPPL
  2191. æFp AppleTalk.p
  2192. æT CONST
  2193. æD afpGetAPPL = 55; {AFPCall command codes}
  2194. æC 
  2195.  
  2196. æKY afpAddCmt
  2197. æFp AppleTalk.p
  2198. æT CONST
  2199. æD afpAddCmt = 56; {AFPCall command codes}
  2200. æC 
  2201.  
  2202. æKY afpRmvCmt
  2203. æFp AppleTalk.p
  2204. æT CONST
  2205. æD afpRmvCmt = 57; {AFPCall command codes}
  2206. æC 
  2207.  
  2208. æKY afpGetCmt
  2209. æFp AppleTalk.p
  2210. æT CONST
  2211. æD afpGetCmt = 58; {AFPCall command codes}
  2212. æC 
  2213.  
  2214. æKY afpAddIcon
  2215. æFp AppleTalk.p
  2216. æT CONST
  2217. æD afpAddIcon = 192; {Special code for ASP Write commands}
  2218. æC 
  2219.  
  2220. æKY xppLoadedBit
  2221. æFp AppleTalk.p
  2222. æT CONST
  2223. æD xppLoadedBit = 5; { XPP bit in PortBUse }
  2224. æC 
  2225.  
  2226. æKY xppUnitNum
  2227. æFp AppleTalk.p
  2228. æT CONST
  2229. æD xppUnitNum = 40; {Unit number for XPP (old ROMs) }
  2230. æC 
  2231.  
  2232. æKY xppRefNum
  2233. æFp AppleTalk.p
  2234. æT CONST
  2235. æD xppRefNum = -41; {.XPP reference number }
  2236. æC 
  2237.  
  2238. æKY scbMemSize
  2239. æFp AppleTalk.p
  2240. æT CONST
  2241. æD scbMemSize = 192; {Size of memory for SCB }
  2242. æC 
  2243.  
  2244. æKY xppFlagClr
  2245. æFp AppleTalk.p
  2246. æT CONST
  2247. æD xppFlagClr = 0; {Cs for AFPCommandBlock }
  2248. æC 
  2249.  
  2250. æKY xppFlagSet
  2251. æFp AppleTalk.p
  2252. æT CONST
  2253. æD xppFlagSet = 128; {StartEndFlag & NewLineFlag fields. }
  2254. æC 
  2255.  
  2256. æKY lapSize
  2257. æFp AppleTalk.p
  2258. æT CONST
  2259. æD lapSize = 20;
  2260. æC 
  2261.  
  2262. æKY ddpSize
  2263. æFp AppleTalk.p
  2264. æT CONST
  2265. æD ddpSize = 26;
  2266. æC 
  2267.  
  2268. æKY nbpSize
  2269. æFp AppleTalk.p
  2270. æT CONST
  2271. æD nbpSize = 26;
  2272. æC 
  2273.  
  2274. æKY atpSize
  2275. æFp AppleTalk.p
  2276. æT CONST
  2277. æD atpSize = 56;
  2278. æC 
  2279.  
  2280. æKY atpXOvalue
  2281. æFp AppleTalk.p
  2282. æT CONST
  2283. æD atpXOvalue = 32; {ATP exactly-once bit }
  2284. æC 
  2285.  
  2286. æKY atpEOMvalue
  2287. æFp AppleTalk.p
  2288. æT CONST
  2289. æD atpEOMvalue = 16; {ATP End-Of-Message bit }
  2290. æC 
  2291.  
  2292. æKY atpSTSvalue
  2293. æFp AppleTalk.p
  2294. æT CONST
  2295. æD atpSTSvalue = 8; {ATP Send-Transmission-Status bit }
  2296. æC 
  2297.  
  2298. æKY atpTIDValidvalue
  2299. æFp AppleTalk.p
  2300. æT CONST
  2301. æD atpTIDValidvalue = 2; {ATP trans. ID valid bit }
  2302. æC 
  2303.  
  2304. æKY atpSendChkvalue
  2305. æFp AppleTalk.p
  2306. æT CONST
  2307. æD atpSendChkvalue = 1; {ATP send checksum bit }
  2308. æC 
  2309.  
  2310. æKY LAPMgrPtr
  2311. æFp AppleTalk.p
  2312. æT CONST
  2313. æD LAPMgrPtr = $B18; {Entry point for LAP Manager}
  2314. æC 
  2315.  
  2316. æKY LAPMgrCall
  2317. æFp AppleTalk.p
  2318. æT CONST
  2319. æD LAPMgrCall = 2; {Offset to LAP routines}
  2320. æC 
  2321.  
  2322. æKY ABCallType
  2323. tLAPRead
  2324. tLAPWrite
  2325. tDDPRead
  2326. tDDPWrite
  2327. tNBPLookup
  2328. tNBPConfirm
  2329. tNBPRegister
  2330. tATPSndRequest
  2331. tATPGetRequest
  2332. tATPSdRsp
  2333. tATPAddRsp
  2334. tATPRequest
  2335. tATPResponse
  2336. æFp AppleTalk.p
  2337. æT TYPE
  2338. æD ABCallType = (tLAPRead,tLAPWrite,tDDPRead,tDDPWrite,tNBPLookup,tNBPConfirm,
  2339.     tNBPRegister,tATPSndRequest,tATPGetRequest,tATPSdRsp,tATPAddRsp,tATPRequest,
  2340.     tATPResponse);
  2341. æC 
  2342.  
  2343. æKY ABProtoType
  2344. lapProto
  2345. ddpProto
  2346. nbpProto
  2347. atpProto
  2348. æFp AppleTalk.p
  2349. æT TYPE
  2350. æD ABProtoType = (lapProto,ddpProto,nbpProto,atpProto);
  2351. æC 
  2352.  
  2353. æKY Str32
  2354. æFp AppleTalk.p
  2355. æT RECORD
  2356. æD Str32 = String[32];
  2357. æC 
  2358.  
  2359. æKY ABByte
  2360. æFp AppleTalk.p
  2361. æT RECORD
  2362. æD ABByte = 1..127;
  2363. æC 
  2364.  
  2365. æKY LAPAdrBlock
  2366. æFp AppleTalk.p
  2367. æT RECORD
  2368. æD LAPAdrBlock = PACKED RECORD
  2369.     dstNodeID: Byte;
  2370.     srcNodeID: Byte;
  2371.     lapProtType: ABByte;
  2372.     END;
  2373. æC 
  2374.  
  2375. æKY ATQEntry
  2376. æFp AppleTalk.p
  2377. æT RECORD
  2378. æD ATQEntry = ^ATQEntry;
  2379. ATQEntry = PACKED RECORD
  2380.     qLink: QElemPtr; {next queue entry}
  2381.     qType: Integer; {queue type}
  2382.     CallAddr: ProcPtr; {Pointer to your routine}
  2383.     END;
  2384. æC 
  2385.  
  2386. æKY AddrBlock
  2387. æFp AppleTalk.p
  2388. æT RECORD
  2389. æD AddrBlock = PACKED RECORD
  2390.     aNet: INTEGER;
  2391.     aNode: Byte;
  2392.     aSocket: Byte;
  2393.     END;
  2394. æC 
  2395.  
  2396. æKY EntityName
  2397. EntityPtr
  2398. æFp AppleTalk.p
  2399. æT RECORD
  2400. æD EntityPtr = ^EntityName;
  2401. EntityName = RECORD
  2402.     objStr: Str32;
  2403.     typeStr: Str32;
  2404.     zoneStr: Str32;
  2405.     END;
  2406. { Real definition of EntityName is 3 PACKED strings of any length (32 is just an example). No
  2407. offests for Asm since each String address must be calculated by adding length byte to last string ptr. 
  2408. In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte unless they are 
  2409. only a byte long. So this will generate correct looking interfaces for Pascal and C, but they will not 
  2410. be the same, which is OK since they are not used. }
  2411. æC 
  2412. { Real definition of EntityName is 3 PACKED strings of any length (32 is just an 
  2413. example). No offsets for Asm since each String address must be calculated by adding 
  2414. length byte to last string ptr. 
  2415. In Pascal, String(32) will be 34 bytes long since fields never start on an odd byte 
  2416. unless they are only a byte long. So this will generate correct looking interfaces for 
  2417. Pascal and C, but they will not be the same, which is OK since they are not used. }
  2418.  
  2419. æKY RetransType
  2420. æFp AppleTalk.p
  2421. æT RECORD
  2422. æD RetransType = PACKED RECORD
  2423.     retransInterval: Byte;
  2424.     retransCount: Byte;
  2425.     END;
  2426. æC 
  2427.  
  2428. æKY BDSElement
  2429. æFp AppleTalk.p
  2430. æT RECORD
  2431. æD BDSElement = RECORD
  2432.     buffSize: INTEGER;
  2433.     buffPtr: Ptr;
  2434.     dataSize: INTEGER;
  2435.     userBytes: LONGINT;
  2436.     END;
  2437. æC 
  2438.  
  2439. æKY BDSType
  2440. BDSPtr
  2441. æFp AppleTalk.p
  2442. æT RECORD
  2443. æD BDSPtr = ^BDSType;
  2444. BDSType = ARRAY [0..7] OF BDSElement;
  2445. æC 
  2446.  
  2447. æKY BitMapType
  2448. æFp AppleTalk.p
  2449. æT RECORD
  2450. æD BitMapType = PACKED ARRAY [0..7] OF BOOLEAN;
  2451. æC 
  2452.  
  2453. æKY ABusRecord
  2454. ABRecPtr
  2455. ABRecHandle
  2456. æFp AppleTalk.p
  2457. æT RECORD
  2458. æD ABRecPtr = ^ABusRecord;
  2459. ABRecHandle = ^ABRecPtr;
  2460. ABusRecord = RECORD
  2461.     abOpcode: ABCallType;
  2462.     abResult: INTEGER;
  2463.     abUserReference: LONGINT;
  2464.     CASE ABProtoType OF
  2465.       lapProto:
  2466.         (lapAddress: LAPAdrBlock;
  2467.         lapReqCount: INTEGER;
  2468.         lapActCount: INTEGER;
  2469.         lapDataPtr: Ptr);
  2470.       ddpProto:
  2471.         (ddpType: Byte;
  2472.         ddpSocket: Byte;
  2473.         ddpAddress: AddrBlock;
  2474.         ddpReqCount: INTEGER;
  2475.         ddpActCount: INTEGER;
  2476.         ddpDataPtr: Ptr;
  2477.         ddpNodeID: Byte);
  2478.       nbpProto:
  2479.         (nbpEntityPtr: EntityPtr;
  2480.         nbpBufPtr: Ptr;
  2481.         nbpBufSize: INTEGER;
  2482.         nbpDataField: INTEGER;
  2483.         nbpAddress: AddrBlock;
  2484.         nbpRetransmitInfo: RetransType);
  2485.       atpProto:
  2486.         (atpSocket: Byte;
  2487.         atpAddress: AddrBlock;
  2488.         atpReqCount: INTEGER;
  2489.         atpDataPtr: Ptr;
  2490.         atpRspBDSPtr: BDSPtr;
  2491.         atpBitmap: BitMapType;
  2492.         atpTransID: INTEGER;
  2493.         atpActCount: INTEGER;
  2494.         atpUserData: LONGINT;
  2495.         atpXO: BOOLEAN;
  2496.         atpEOM: BOOLEAN;
  2497.         atpTimeOut: Byte;
  2498.         atpRetries: Byte;
  2499.         atpNumBufs: Byte;
  2500.         atpNumRsp: Byte;
  2501.         atpBDSSize: Byte;
  2502.         atpRspUData: LONGINT;
  2503.         atpRspBuf: Ptr;
  2504.         atpRspSize: INTEGER);
  2505.     END;
  2506. æC 
  2507. _______________________________________________________________________________
  2508.  
  2509. »CALLING THE APPLETALK MANAGER FROM PASCAL
  2510. _______________________________________________________________________________
  2511.  
  2512. This section discusses how to use the AppleTalk Manager from Pascal. Equivalent
  2513. assembly-language information is given in the “Calling the AppleTalk Manager from
  2514. Assembly Language” section.
  2515.  
  2516. You can execute many AppleTalk Manager routines either synchronously (meaning that
  2517. the application can’t continue until the routine is completed) or asynchronously
  2518. (meaning that the application is free to perform other tasks while the routine is
  2519. being executed).
  2520.  
  2521. When an application calls an AppleTalk Manager routine asynchronously, an I/O request
  2522. is placed in the appropriate driver’s I/O queue, and control returns to the calling
  2523. program—possibly even before the actual I/O is completed. Requests are taken from the
  2524. queue one at a time, and processed; meanwhile, the calling program is free to work on
  2525. other things.
  2526.  
  2527. The routines that can be executed asynchronously contain a Boolean parameter called
  2528. async. If async is TRUE, the call is executed asynchronously; otherwise the call is
  2529. executed synchronously. Every time an asynchronous routine call is completed, the
  2530. AppleTalk Manager posts a network event. The message field of the event record will
  2531. contain a handle to the parameter block that was used to make that call.
  2532.  
  2533. Most AppleTalk Manager routines return an integer result code of type OSErr. Each
  2534. routine description lists all of the applicable result codes generated by the AppleTalk
  2535. Manager, along with a short description of what the result code means. Lengthier
  2536. explanations of all the result codes can be found in the summary at the end of the
  2537. chapter. Result codes from other parts of the Operating System may also be returned.
  2538. (See Appendix A for a list of all result codes.)
  2539.  
  2540. Many Pascal calls to the AppleTalk Manager require information passed in a parameter
  2541. block of type ABusRecord. The exact content of an ABusRecord depends on the protocol
  2542. being called:
  2543.  
  2544. TYPE  ABProtoType  =  (lapProto,ddpProto,nbpProto,atpProto);
  2545.       ABusRecord   =  RECORD
  2546.                         abOpcode:        ABCallType; {type of call}
  2547.                         abResult:        INTEGER;    {result code}
  2548.                         abUserReference: LONGINT;    {for your use}
  2549.                         CASE ABProtoType OF
  2550.                           lapProto:
  2551.                             . . .     {ALAP parameters}
  2552.                           ddpProto:
  2553.                             . . .     {DDP parameters}
  2554.                           nbpProto:
  2555.                             . . .     {NBP parameters}
  2556.                           atpProto:
  2557.                             . . .     {ATP parameters}
  2558.                         END;
  2559.                       END;
  2560.  
  2561.       ABRecPtr     = ^ABusRecord;
  2562.       ABRecHandle  = ^ABRecPtr;
  2563.  
  2564. The value of the abOpcode field is inserted by the AppleTalk Manager when the call is
  2565. made, and is always a member of the following set:
  2566.  
  2567. TYPE  ABCallType = (tLAPRead,tLAPWrite,tDDPRead,tDDPWrite,tNBPLookup,
  2568.                     tNBPConfirm,tNBPRegister,tATPSndRequest,
  2569.                     tATPGetRequest,tATPSdRsp,tATPAddRsp,tATPRequest,
  2570.                     tATPRespond);
  2571.  
  2572. The abUserReference field is available for use by the calling program in any way it
  2573. wants. This field isn’t used by the AppleTalk Manager routines or drivers.
  2574.  
  2575. The size of an ABusRecord data structure in bytes is given by one of the following
  2576. constants:
  2577.  
  2578. CONST  lapSize = 20;
  2579.        ddpSize = 26;
  2580.        nbpSize = 26;
  2581.        atpSize = 56;
  2582.  
  2583. Variables of type ABusRecord must be allocated in the heap with Memory Manager NewHandle
  2584. calls. For example:
  2585.  
  2586.   myABRecord := ABRecHandle(NewHandle(ddpSize))
  2587.  
  2588. Warning:  These Memory Manager calls can’t be made inside interrupts.
  2589.  
  2590. Routines that are executed asynchronously return control to the calling program with
  2591. the result code noErr as soon as the call is placed in the driver’s I/O queue. This
  2592. isn’t an indication of successful call completion; it simply indicates that the call
  2593. was successfully queued to the appropriate driver. To determine when the call is
  2594. actually completed, you can either check for a network event or poll the abResult
  2595. field of the call’s ABusRecord. The abResult field, set to 1 when the call is made,
  2596. receives the actual result code upon completion of the call.
  2597.  
  2598. Warning:  A data structure of type ABusRecord is often used by the AppleTalk
  2599.           Manager during an asynchronous call, and so is locked by the
  2600.           AppleTalk Manager. Don’t attempt to unlock or use such a variable.
  2601.  
  2602. Each routine description includes a list of the ABusRecord fields affected by the
  2603. routine. The arrow next to each field name indicates whether it’s an input, output,
  2604. or input/output parameter:
  2605.  
  2606. Arrow    Meaning
  2607.   -->    Parameter is passed to the routine
  2608.   <--    Parameter is returned by the routine
  2609.   <->    Parameter is passed to and returned by the routine
  2610.  
  2611. æKY AFPCommandBlock
  2612. æFp AppleTalk.p
  2613. æT RECORD
  2614. æD AFPCommandBlock = PACKED RECORD
  2615.     cmdByte: Byte;
  2616.     startEndFlag: Byte;
  2617.     forkRefNum: INTEGER;
  2618.     rwOffset: LONGINT;
  2619.     reqCount: LONGINT;
  2620.     newLineFlag: Byte;
  2621.     newLineChar: CHAR;
  2622.     END;
  2623. æC 
  2624.  
  2625. æKY WDSElement
  2626. æFp AppleTalk.p
  2627. æT RECORD
  2628. æD WDSElement = RECORD
  2629.     entryLength: INTEGER;
  2630.     entryPtr: Ptr;
  2631.     END;
  2632. æC 
  2633.  
  2634. æKY NamesTableEntry
  2635. æFp AppleTalk.p
  2636. æT RECORD
  2637. æD NamesTableEntry = RECORD
  2638.     qLink: QElemPtr;
  2639.     nteAddress: AddrBlock;
  2640.     nteData: PACKED ARRAY [1..100] OF CHAR;
  2641.     END;
  2642. æC 
  2643.  
  2644. æKY MPPParmType
  2645. æFp AppleTalk.p
  2646. æT RECORD
  2647. æD MPPParmType = (LAPWriteParm,AttachPHParm,DetachPHParm,OpenSktParm,CloseSktParm,
  2648.     WriteDDPParm,OpenATPSktParm,CloseATPSktParm,SendRequestParm,GetRequestParm,
  2649.     SendResponseParm,AddResponseParm,RelTCBParm,RelRspCBParm,RegisterNameParm,
  2650.     LookupNameParm,ConfirmNameParm,RemoveNameParm,SetSelfSendParm,NSendRequestParm,
  2651.     KillSendReqParm,KillGetReqParm,KillNBPParm,GetAppleTalkInfoParm,KillAllGetReqParm,
  2652.     ATalkClosePrepParm,CancelATalkClosePrepParm);
  2653. æC 
  2654.  
  2655. æKY MPPParamBlock
  2656. MPPPBPtr
  2657. æFp AppleTalk.p
  2658. æT RECORD
  2659. æD MPPPBPtr = ^MPPParamBlock;
  2660. MPPParamBlock = PACKED RECORD
  2661.     qLink: QElemPtr; {->Write Data Structure}
  2662.     qType: INTEGER; {queue type}
  2663.     ioTrap: INTEGER; {routine trap}
  2664.     ioCmdAddr: Ptr; {routine address}
  2665.     ioCompletion: ProcPtr; {completion routine}
  2666.     ioResult: OSErr; {result code}
  2667.     ioNamePtr: StringPtr; {->filename}
  2668.     ioVRefNum: INTEGER; {volume reference or drive number}
  2669.     ioRefNum: INTEGER; {driver reference number}
  2670.     csCode: INTEGER; {call command code AUTOMATICALLY set}
  2671.     CASE MPPParmType OF
  2672.       LAPWriteParm:
  2673.         (filler0: INTEGER;
  2674.         wdsPointer: Ptr); {->Write Data Structure}
  2675.       AttachPHParm,DetachPHParm:
  2676.         (protType: Byte; {ALAP Protocol Type}
  2677.         filler1: Byte;
  2678.         handler: Ptr); {->protocol handler routine}
  2679.       OpenSktParm,CloseSktParm,WriteDDPParm:
  2680.         (socket: Byte; {socket number}
  2681.         checksumFlag: Byte; {checksum flag}
  2682.         listener: Ptr); {->socket listener routine}
  2683.       RegisterNameParm,LookupNameParm,ConfirmNameParm,RemoveNameParm:
  2684.         (interval: Byte; {retry interval}
  2685.         count: Byte; {retry count}
  2686.         entityPtr: Ptr; {->names table element or ->entity name}
  2687.         CASE MPPParmType OF
  2688.           RegisterNameParm:
  2689.             (verifyFlag: Byte; {set if verify needed}
  2690.             filler3: Byte);
  2691.           LookupNameParm:
  2692.             (retBuffPtr: Ptr; {->return buffer}
  2693.             retBuffSize: INTEGER; {return buffer size}
  2694.             maxToGet: INTEGER; {matches to get}
  2695.             numGotten: INTEGER); {matched gotten}
  2696.           ConfirmNameParm:
  2697.             (confirmAddr: AddrBlock; {->entity}
  2698.             newSocket: Byte; {socket number}
  2699.             filler4: Byte));
  2700.       SetSelfSendParm:
  2701.         (newSelfFlag: Byte; {self-send toggle flag}
  2702.         oldSelfFlag: Byte); {previous self-send state}
  2703.       KillNBPParm:
  2704.         (nKillQEl: Ptr); {ptr to Q element to cancel}
  2705.       GetAppleTalkInfoParm:
  2706.         (version: Integer; {requested info version}
  2707.         varsPtr: Ptr; {pointer to well known MPP vars}
  2708.         DCEPtr: Ptr; {pointer to MPP DCE}
  2709.         portID: Integer; {port number [0..7]}
  2710.         configuration: LONGINT; {32-bit configuration word}
  2711.         selfSend: Integer; {non zero if SelfSend enabled}
  2712.         netLo: Integer; {low value of network range}
  2713.         netHi: Integer; {high value of network range}
  2714.         ourAddr: LONGINT; {our 24-bit AppleTalk address}
  2715.         routerAddr: LONGINT; {24-bit address of (last) router}
  2716.         numOfPHs: Integer; {max. number of protocol handlers}
  2717.         numOfSkts: Integer; {max. number of static sockets}
  2718.         numNBPEs: Integer; {max. concurrent NBP requests}
  2719.         nTQueue: Ptr; {pointer to registered name queue}
  2720.         LAlength: Integer; {length in bytes of data link addr}
  2721.         linkAddr: Ptr; {data link address returned}
  2722.         zoneName: Ptr); {zone name returned}
  2723.       ATalkClosePrepParm, CancelATalkClosePrepParm:
  2724.         (appName: Ptr); {pointer to application name in buffer}
  2725.     END;
  2726. æC 
  2727.  
  2728. æKY ATPParamBlock
  2729. ATPPBPtr
  2730. æFp AppleTalk.p
  2731. æT RECORD
  2732. æD ATPPBPtr = ^ATPParamBlock;
  2733. ATPParamBlock = PACKED RECORD
  2734.     qLink: QElemPtr; {next queue entry}
  2735.     qType: INTEGER; {queue type}
  2736.     ioTrap: INTEGER; {routine trap}
  2737.     ioCmdAddr: Ptr; {routine address}
  2738.     ioCompletion: ProcPtr; {completion routine}
  2739.     ioResult: OSErr; {result code}
  2740.     userData: LONGINT; {ATP user bytes}
  2741.     reqTID: INTEGER; {request transaction ID}
  2742.     ioRefNum: INTEGER; {driver reference number}
  2743.     csCode: INTEGER; {Call command code automatically set}
  2744.     atpSocket: Byte; {currBitMap or socket number}
  2745.     CASE MPPParmType OF
  2746.       SendRequestParm,SendResponseParm, GetRequestParm, AddResponseParm, KillSendReqParm:
  2747.     atpFlags: Byte; {control information}
  2748.     addrBlock: AddrBlock; {source/dest. socket address}
  2749.     reqLength: INTEGER; {request/response length}
  2750.     reqPointer: Ptr; {-> request/response data}
  2751.     bdsPointer: Ptr; {-> response BDS}
  2752.     CASE MPPParmType OF
  2753.       SendRequestParm:
  2754.         (numOfBuffs: Byte; {number of responses expected}
  2755.         timeOutVal: Byte; {timeout interval}
  2756.         numOfResps: Byte; {number of responses actually received}
  2757.         retryCount: Byte; {number of retries}
  2758.         intBuff: INTEGER); {used internally for NSendRequest}
  2759.       SendResponseParm:
  2760.         (filler0: Byte; {numOfBuffs}
  2761.         bdsSize: Byte; {number of BDS elements}
  2762.         transID: INTEGER); {transaction ID}
  2763.       GetRequestParm:
  2764.         (bitMap: Byte; {bit map}
  2765.         filler1: Byte);
  2766.       AddResponseParm:
  2767.         (rspNum: Byte; {sequence number}
  2768.         filler2: Byte);
  2769.       KillSendReqParm:
  2770.         (aKillQEl: Ptr); {ptr to Q element to cancel}
  2771.     END;
  2772. æC 
  2773.  
  2774. æKY XPPPrmBlkType
  2775. æFp AppleTalk.p
  2776. æT RECORD
  2777. æD XPPPrmBlkType = (XPPPrmBlk,ASPSizeBlk,ASPAbortPrm,xCallParam);
  2778. æC 
  2779.  
  2780. æKY XPPSubPrmType
  2781. æFp AppleTalk.p
  2782. æT RECORD
  2783. æD XPPSubPrmType = (ASPOpenPrm,ASPSubPrm);
  2784. æC 
  2785.  
  2786. æKY XPPEndPrmType
  2787. æFp AppleTalk.p
  2788. æT RECORD
  2789. æD XPPEndPrmType = (AFPLoginPrm,ASPEndPrm);
  2790. æC 
  2791.  
  2792. æKY XPPParamBlock
  2793. XPPParmBlkPtr
  2794. æFp AppleTalk.p
  2795. æT RECORD
  2796. æD XPPParmBlkPtr = ^XPPParamBlock;
  2797. XPPParamBlock = PACKED RECORD
  2798.     qLink: QElemPtr;
  2799.     qType: INTEGER; {queue type}
  2800.     ioTrap: INTEGER; {routine trap}
  2801.     ioCmdAddr: Ptr; {routine address}
  2802.     ioCompletion: ProcPtr; {completion routine}
  2803.     ioResult: OSErr; {result code}
  2804.     cmdResult: LONGINT; {command result (ATP user bytes)}
  2805.     ioVRefNum: INTEGER; {volume reference or drive number}
  2806.     ioRefNum: INTEGER; {driver reference number}
  2807.     csCode: INTEGER; {call command code}
  2808.     CASE XPPPrmBlkType OF
  2809.       ASPAbortPrm:
  2810.         (abortSCBPtr: Ptr); {SCB pointer for AbortOS}
  2811.       ASPSizeBlk:
  2812.         (aspMaxCmdSize: INTEGER; {for SPGetParms}
  2813.         aspQuantumSize: INTEGER; {for SPGetParms}
  2814.         numSesss: INTEGER); {for SPGetParms}
  2815.       XPPPrmBlk:
  2816.         (sessRefnum: INTEGER; {offset to session refnum}
  2817.         aspTimeout: Byte; {timeout for ATP}
  2818.         aspRetry: Byte; {retry count for ATP}
  2819.         CASE XPPSubPrmType OF
  2820.           ASPOpenPrm:
  2821.             (serverAddr: AddrBlock; {server address block}
  2822.             scbPointer: Ptr; {SCB pointer}
  2823.             attnRoutine: Ptr); {attention routine pointer}
  2824.           ASPSubPrm:
  2825.             (cbSize: INTEGER; {command block size}
  2826.             cbPtr: Ptr; {command block pointer}
  2827.             rbSize: INTEGER; {reply buffer size}
  2828.             rbPtr: Ptr; {reply buffer pointer}
  2829.             CASE XPPEndPrmType OF
  2830.               AFPLoginPrm:
  2831.                 (afpAddrBlock: AddrBlock; {address block in AFP login}
  2832.                 afpSCBPtr: Ptr; {SCB pointer in AFP login}
  2833.                 afpAttnRoutine: Ptr); {Attn routine pointer in AFP login}
  2834.               ASPEndPrm:
  2835.                 (wdSize: INTEGER; {write data size}
  2836.                 wdPtr: Ptr; {write data pointer}
  2837.                 ccbStart: ARRAY [0..295] OF Byte))); {afpWrite max size = 296, else 150}
  2838.       xCallParam:
  2839.         (xppSubCode: Integer; {always zipGetZoneList (6)}
  2840.         xppTimeout: Byte; {retry interval (seconds)}
  2841.         xppRetry: Byte; {retry count}
  2842.         filler1: Integer; {word space for rent.  see the super.}
  2843.         zipBuffPtr: Ptr; {pointer to buffer (must be 578 bytes)}
  2844.         zipNumZones: Integer; {no. of zone names in this response}
  2845.         zipLastFlag: Byte; {non-zero if no more zones}
  2846.         filler2: Byte; {filler}
  2847.         ziplnfoField: PACKED ARRAY [1..70] OF Byte; {on initial call, set first word to zero}
  2848.     END;
  2849. æC 
  2850.  
  2851. æKY OpenXPP
  2852. æFp AppleTalk.p
  2853. æT FUNCTION
  2854. æD FUNCTION OpenXPP(VAR xppRefnum: INTEGER): OSErr;
  2855. æDT myVariable := OpenXPP(xppRefnum);
  2856. æRI æRI 
  2857. æC 
  2858. »Opening the .XPP Driver
  2859.  
  2860. To open the .XPP driver, issue a Device Manager Open call.  (Refer to the Device
  2861. Manager chapter.)  The name of the .XPP driver is '.XPP'.  The original Macintosh
  2862. ROMs require that .XPP be opened only once. With new ROMs, the .XPP unit number can
  2863. always be obtained through an Open call.  With old ROMs only, the .XPP unit number
  2864. must be hard coded to XPPUnitNum (40) since only one Open call can be issued to the
  2865. driver.
  2866.  
  2867. The .XPP driver cannot be opened unless AppleTalk is open.  The application must
  2868. ensure that the .MPP and .ATP drivers are opened, as described earlier in this chapter.
  2869.  
  2870. The xppLoaded bit (bit 5) in the PortBUse byte in low memory indicates whether or not
  2871. the .XPP driver is open.
  2872.  
  2873. »Example
  2874.  
  2875. The following is an example of the procedure an application might use to open the
  2876. .XPP driver.
  2877.  
  2878. ;    Routine: OpenXPP
  2879. ;
  2880. ;        Open the .XPP driver and return the driver refNum for it.
  2881. ;
  2882. ;        Exit:    D0 = error code (ccr's set)
  2883. ;                 D1 = XPP driver refNum (if no errors)
  2884. ;
  2885. ;        All other registers preserved
  2886. ;
  2887. xppUnitNum    EQU    40                 ;default XPP driver number
  2888. xppTfRNum     EQU    -(xppUnitNum+1)    ;default XPP driver refNum
  2889.  
  2890. OpenXPP
  2891.     MOVE.L    A0-A1/D2,-(SP)            ;save registers
  2892.     MOVE      ROM85,D0                  ;check ROM type byte
  2893.     BPL.S     @10                       ;branch if >=128K ROMs
  2894.     BTST      #xppLoadedBit,PortBUse    ;is the XPP driver open already?
  2895.     BEQ.S     @10                       ;if not open, then branch to Open code
  2896.     MOVE      #xppTfRNum,D1             ;else use this as driver refnum
  2897.     MOVEQ     #0,D0                     ;set noErr
  2898.     BRA.S     @90                       ;and exit
  2899. ;
  2900. ; XPP driver not open. Make an _Open call to it. If using a 128K
  2901. ; ROM machine and the driver is already open, we will make another
  2902. ; Open call to it just so we get the correct driver refNum.
  2903. ;
  2904. @10 SUB       #ioQElSize,SP             ;allocate temporary param block
  2905.     MOVE.L    SP,A0                     ;A0 -> param block
  2906.     LEA       XPPName, A1               ;A1 -> XPP (ASP/AFP) driver name
  2907.     MOVE.L    A1,ioFileName(A0)         ;driver name into param block
  2908.     CLR.B     ioPermssn(A0)             ;clear permissions byte
  2909.     _Open
  2910.     MOVE      ioRefNum(A0),D1           ;D1=driver refNum (invalid if error)
  2911.     ADD       #ioQElSize,SP             ;deallocate temp param block
  2912. @90 MOVE.L    (SP)+,A0-A1/D2            ;restore registers
  2913.     TST       D0                        ;error? (set ccr's)
  2914.     RTS
  2915.     
  2916. XPPName  DC.B  4                        ;length of string
  2917.          DC.B  '.XPP'                   ;driver name
  2918.  
  2919. From Pascal, XPP can be opened through the OpenXPP call, which returns the driver’s
  2920. reference number:
  2921.  
  2922. FUNCTION OpenXPP (VAR xppRefnum: INTEGER) : OSErr;
  2923.  
  2924. »Open Errors
  2925.  
  2926. Errors returned when calling the Device Manager Open routine if the function does not
  2927. execute properly include the following:
  2928.  
  2929.   •  errors returned by System
  2930.   •  portInUse is returned if the AppleTalk port is in use by a driver
  2931.      other than AppleTalk or if AppleTalk is not open.
  2932.  
  2933. »Closing the .XPP Driver
  2934.  
  2935. To close the .XPP driver, call the Device Manager Close routine.
  2936.  
  2937. Warning:  There is generally no reason to close the driver.  Use this
  2938.           call sparingly, if at all.  This call should generally be used
  2939.           only by system-level applications.
  2940.  
  2941. »Close Errors
  2942.  
  2943. Errors returned when calling the Device Manager Close routine if the function does
  2944. not execute properly include the following:
  2945.  
  2946.   •  errors returned by System
  2947.   •  closeErr (new ROMs only) is returned if you try to close the driver
  2948.      and there are sessions active through that driver.  When sessions are
  2949.      active, closeErr is returned and the driver remains open.
  2950.   •  on old ROMs the driver is closed whether or not sessions are active
  2951.      and no error is returned. Results are unpredictable if sessions are
  2952.      still active.
  2953.  
  2954. »Session Control Block
  2955.  
  2956. The session control block (SCB) is a nonrelocatable block of data passed by the
  2957. caller to XPP upon session opening. XPP reserves this block for use in maintaining an
  2958. open session.   The SCB size is defined by the constant scbMemSize.  The SCB is a
  2959. locked block, and as long as the session is open, the SCB cannot be modified in any
  2960. way by the application.  There is one SCB for each open session. This block can be
  2961. reused once a CloseSess call is issued and completed for that session or when the
  2962. session is indicated as closed.
  2963.     
  2964.  
  2965. æKY ASPOpenSession
  2966. æFp AppleTalk.p
  2967. æT FUNCTION
  2968. æD FUNCTION ASPOpenSession(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  2969. æDT myVariable := ASPOpenSession(thePBptr,async);
  2970. æRI V-536
  2971. æC 
  2972. »AppleTalk Session Protocol Functions
  2973.  
  2974. This section contains descriptions of the .XPP driver functions that you can call. 
  2975. Each function description shows the required parameter block fields, their offsets
  2976. within the parameter block and a brief definition of the field.  Possible result
  2977. codes are also described.
  2978.  
  2979. »Note on Result Codes
  2980.  
  2981. An important distinction exists between the aspParamErr and aspSessClose  result
  2982. codes that may be returned by the .XPP driver.
  2983.  
  2984. When the driver returns aspParamErr to a call that takes as an input a session reference
  2985. number, the session reference number does not relate to a valid open session.  There
  2986. could be several reasons for this, such as the workstation or server end closed the
  2987. session or the server end of the session died.
  2988.  
  2989. The aspSessClosed result code indicates that even though the session reference number
  2990. relates to a valid session, that particular session is in the process of closing down
  2991. (although  the session is not yet closed).
  2992.  
  2993. FUNCTION ASPOpenSession (xParamBlock: XPPParmBlkPtr; async: BOOLEAN) : OSErr;
  2994.  
  2995. Parameter block
  2996.   -->    26    csCode       word       Always ASPOpenSess
  2997.   -->    28    sessRefnum   word       Session reference number
  2998.   -->    30    aspTimeout   byte       Retry interval in seconds
  2999.   -->    31    aspRetry     byte       Number of retries
  3000.   -->    32    serverAddr   long word  Server socket address
  3001.   -->    36    scbPointer   pointer    Pointer to session control block
  3002.   -->    40    attnRoutine  pointer    Pointer to attention routine
  3003.  
  3004. ASPOpenSession initiates (opens) a session between the workstation and a server.  The
  3005. required parameter block is shown above.  A brief definition of the fields follows.
  3006.  
  3007. SessRefnum is a unique number identifying the open session between the workstation
  3008. and the server.  The SessRefnum is returned when the function completes successfully
  3009. and is used in all calls to identify the session.
  3010.  
  3011. ASPTimeOut is the interval in seconds between retries of the open session request.
  3012.  
  3013. ASPRetry is the number of retries that will be attempted.
  3014.  
  3015. ServerAddr is the network identifier or address of the socket on which the server is
  3016. listening.
  3017.  
  3018. SCBPointer points to a nonrelocatable block of data for the session control block
  3019. (SCB) that the .XPP driver reserves for use in maintaining an open session.   The SCB
  3020. size is defined by the constant scbMemSize.  The SCB is a locked block and as long as
  3021. the session is open, the SCB cannot be modified in any way by the application.  There
  3022. is one SCB for each open session.  This block can be reused when a CloseSess call is
  3023. issued and completed for that session, or when the session is indicated as closed
  3024. through return of aspParamErr as the result of a call for that session.
  3025.  
  3026. AttnRoutine is a pointer to a routine that is invoked if an attention from the server
  3027. is received, or upon session closing.  If this pointer is equal to zero, no attention
  3028. routine will be invoked.
  3029.  
  3030. Result codes    aspNoMoreSess    Driver cannot support another session
  3031.                 aspParamErr      Server returned bad (positive) error code    
  3032.                 aspNoServers     No servers at that address, or the server
  3033.                                  did not respond to the request
  3034.                 reqAborted       OpenSess was aborted by an AbortOS
  3035.                 aspBadVersNum    Server cannot support the offered 
  3036.                                  version number
  3037.                 aspServerBusy    Server cannot open another session
  3038.  
  3039. Note: The number of sessions that the driver is capable of supporting
  3040.       depends on the machine that the driver is running on. 
  3041.  
  3042. æKY ASPCloseSession
  3043. æFp AppleTalk.p
  3044. æT FUNCTION
  3045. æD FUNCTION ASPCloseSession(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3046. æDT myVariable := ASPCloseSession(thePBptr,async);
  3047. æRI V-537
  3048. æC  
  3049. Parameter block
  3050.   -->    26    csCode      word  Always ASPCloseSession
  3051.   -->    28    sessRefnum  word  Session reference number
  3052.  
  3053. ASPCloseSession closes the session identified by the sessRefnum returned in the
  3054. ASPOpenSession call.  ASPCloseSession aborts any calls that are active on the session,
  3055. closes the session, and calls the attention routine, if any, with an attention code
  3056. of zero (zero is invalid as a real attention code).
  3057.  
  3058. Result codes    aspParamErr      Parameter error, indicates an invalid
  3059.                                  session reference number
  3060.                 aspSessClosed    Session already in process of closing
  3061.  
  3062. æKY ASPAbortOS
  3063. æFp AppleTalk.p
  3064. æT FUNCTION
  3065. æD FUNCTION ASPAbortOS(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3066. æDT myVariable := ASPAbortOS(thePBptr,async);
  3067. æRI V-537
  3068. æC  
  3069. Parameter block
  3070.   -->    26    csCode            word     Always ASPAbortOS
  3071.   -->    28    abortSCBPointer   pointer  Pointer to session control block
  3072.  
  3073. ASPAbortOS aborts a pending (not yet completed) ASPOpenSession call.  The aborted
  3074. ASPOpenSession call will return a reqAborted error.
  3075.  
  3076. AbortSCBPointer points to the original SCB used in the the pending ASPOpenSession
  3077. call.
  3078.  
  3079. Result codes    cbNotFound    SCB not found, no outstanding open session
  3080.                               to be aborted.
  3081.                               Pointer did not point to an open session SCB.
  3082.  
  3083. æKY ASPGetParms
  3084. æFp AppleTalk.p
  3085. æT FUNCTION
  3086. æD FUNCTION ASPGetParms(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3087. æDT myVariable := ASPGetParms(thePBptr,async);
  3088. æRI V-538
  3089. æC  
  3090. Parameter block
  3091.   -->    26    csCode          word  Always ASPGetParms
  3092.   -->    28    aspMaxCmdSize   word  Maximum size of command block
  3093.   -->    30    aspQuantumSize  word  Maximum data size
  3094.   -->    32    numSesss        word  Number of sessions
  3095.  
  3096. ASPGetParms returns three ASP parameters.  This call does not require an open session.
  3097.  
  3098. ASPMaxCmdSize is the maximum size of a command that can be sent to the server.
  3099.  
  3100. ASPQuantumSize is the maximum size of data that can be transferred to the server in a
  3101. Write request or from the server in a command reply.
  3102.  
  3103. NumSess is the number of concurrent sessions supported by the driver.
  3104.  
  3105. æKY ASPCloseAll
  3106. æFp AppleTalk.p
  3107. æT FUNCTION
  3108. æD FUNCTION ASPCloseAll(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3109. æDT myVariable := ASPCloseAll(thePBptr,async);
  3110. æRI V-538
  3111. æC  
  3112. Parameter block
  3113.   -->    26    csCode  word  Always ASPCloseAll
  3114.  
  3115. ASPCloseAll closes every session that the driver has active, aborting all active
  3116. requests and invoking the attention routines where provided.  This call should be
  3117. used carefully.  ASPCloseAll can be used as a system level resource for making sure
  3118. all sessions are closed prior to closing the driver.
  3119.  
  3120. æKY ASPUserWrite
  3121. æFp AppleTalk.p
  3122. æT FUNCTION
  3123. æD FUNCTION ASPUserWrite(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3124. æDT myVariable := ASPUserWrite(thePBptr,async);
  3125. æRI V-538
  3126. æC  
  3127. Parameter block
  3128.   -->    18    cmdResult   long word  ASP command result
  3129.   -->    26    csCode      word       Always UserWrite
  3130.   -->    28    sessRefnum  word       Session reference number
  3131.   -->    30    aspTimeout  byte       Retry interval in seconds
  3132.   -->    32    cbSize      word       Command block size
  3133.   -->    34    cbPtr       pointer    Command block pointer
  3134.   <->    38    rbSize      word       Reply buffer size and reply size
  3135.   -->    40    rbPtr       pointer    Reply buffer pointer
  3136.   <->    44    wdSize      word       Write data size
  3137.   -->    46    wdPtr       pointer    Write data pointer
  3138.   -->    50    ccbStart    record     Start of memory for CCB
  3139.  
  3140. ASPUserWrite transfers data on a session.  ASPUserWrite is one of the two main calls
  3141. that can be used to transfer data on an ASP session.  The other call that performs a
  3142. similar data transfer  is ASPUserCommand described below.  The ASPUserWrite command
  3143. returns data in two different places.  Four bytes of data are returned in the cmdResult
  3144. field and a variable size reply buffer is also returned.
  3145.  
  3146. CmdResult is four bytes of data returned by the server.
  3147.  
  3148. SessRefnum is the session reference number returned in the ASPOpenSession call.
  3149.  
  3150. ASPTimeOut is the interval in seconds between retries of the call.  Notice that there
  3151. is no aspRetry field (retries are infinite).  The command will be retried at the
  3152. prescribed interval until completion or the session is closed.
  3153.  
  3154. CBSize is the size in bytes of the command data that is to be written on the session.
  3155.  The size of the command block must not exceed the value of aspMaxCmdSize returned by
  3156. the ASPGetParms call. Note that this buffer is not the data to be written by the
  3157. command but only the data of the command itself.
  3158.  
  3159. CBPtr points to the command data.
  3160.  
  3161. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3162. command.  RBSize is also returned and indicates the size of the reply that was actually
  3163. returned.
  3164.  
  3165. RBPtr points to the reply buffer.
  3166.  
  3167. WDSize is passed and indicates the size of the write data in bytes to be sent by the
  3168. command.  WDSize is also returned and indicates the size of the write data that was
  3169. actually written.
  3170.  
  3171. WDPointer points to the write data buffer.
  3172.  
  3173. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3174. control block.  The size of this block is equal to a maximum of 296 bytes.  To determine
  3175. the exact requirement, refer to the CCB Sizes section of this document.
  3176.  
  3177. Result codes     aspParamErr       Invalid session number, session has
  3178.                                    been closed
  3179.                  aspSizeErr        Command block size is bigger than MaxCmdSize
  3180.                  aspSessClosed     Session is closing
  3181.                  aspBufTooSmall    Reply is bigger than response buffer;
  3182.                                    the buffer will be filled, data will
  3183.                                    be truncated
  3184.  
  3185. æKY ASPUserCommand
  3186. æFp AppleTalk.p
  3187. æT FUNCTION
  3188. æD FUNCTION ASPUserCommand(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3189. æDT myVariable := ASPUserCommand(thePBptr,async);
  3190. æRI V-539
  3191. æC  
  3192. Parameter block
  3193.   -->    18    cmdResult   long word  ASP command result
  3194.   -->    26    csCode      word       Always ASPUserCommand
  3195.   -->    28    sessRefnum  word       Session number
  3196.   -->    30    aspTimeout  byte       Retry interval in seconds
  3197.   -->    32    cbSize      word       Command block size
  3198.   -->    34    cbPtr       pointer    Command block pointer
  3199.   <->    38    rbSize      word       Reply buffer and reply size
  3200.   -->    40    rbPtr       pointer    Reply buffer pointer
  3201.   -->    50    ccbStart    record     Start of memory for CCB
  3202.  
  3203. ASPUserCommand is used to send a command to the server on a session.
  3204.  
  3205. SessRefnum is the session reference number returned in the ASPOpenSession call.
  3206.  
  3207. ASPTimeOut is the interval in seconds between retries of the call.  Notice that there
  3208. is no aspRetry field (retries are infinite).  The command will be retried at the
  3209. prescribed interval until completion or the session is closed.
  3210.  
  3211. CBSize is the size in bytes of the block of data that contains the command to be sent
  3212. to the server on the session.  The size of the command block must not exceed the
  3213. value of aspMaxCmdSize returned by the ASPGetParms call.
  3214.  
  3215. CBPointer points to the block of data containing the command that is to be sent to
  3216. the server on the session.
  3217.  
  3218. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3219. command.  RBSize is also returned and indicates the size of the reply that was actually
  3220. returned.
  3221.  
  3222. RBPtr points to the reply buffer.
  3223.  
  3224. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3225. control block.  The size of this block is equal to a maximum of 150 bytes.  To determine
  3226. the exact requirement refer to the CCB Sizes section of this document.
  3227.  
  3228. Result codes     aspParamErr       Invalid session number, session has
  3229.                                    been closed
  3230.                  aspSizeErr        Command block size is bigger than MaxCmdSize
  3231.                  aspSessClosed     Session is closing
  3232.                  aspBufTooSmall    Reply is bigger than response buffer;
  3233.                                    the buffer will be filled, data will
  3234.                                    be truncated
  3235.  
  3236. æKY ASPGetStatus
  3237. æFp AppleTalk.p
  3238. æT FUNCTION
  3239. æD FUNCTION ASPGetStatus(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3240. æDT myVariable := ASPGetStatus(thePBptr,async);
  3241. æRI V-540
  3242. æC  
  3243. Parameter block
  3244.   -->    26    csCode      word       Always ASPGetStatus
  3245.   -->    30    aspTimeout  byte       Retry interval in seconds
  3246.   -->    31    aspRetry    byte       Number of retries
  3247.   -->    32    serverAddr  long word  Server socket address
  3248.   <->    38    rbSize      word       Reply buffer and reply size
  3249.   -->    40    rbPtr       pointer    Reply buffer pointer
  3250.   -->    50    ccbStart    record     Start of memory for CCB
  3251.  
  3252. ASPGetStatus returns server status.  This call is also used as GetServerInfo at the
  3253. AFP level. This call is unique in that it transfers data over the network without
  3254. having a session open.  This call does not pass any data but requests that server
  3255. status be returned.
  3256.  
  3257. ASPTimeOut is the interval in seconds between retries of the call.
  3258.  
  3259. ASPRetry is the number of retries that will be attempted.
  3260.  
  3261. ServerAddr is the network identifier or address of the socket on which the server is
  3262. listening.
  3263.  
  3264. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3265. command. RBSize is also returned and indicates the size of the reply that was actually
  3266. returned.
  3267.  
  3268. RBPtr points to the reply buffer.
  3269.  
  3270. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3271. control block.  The size of this block is equal to a maximum of 150 bytes.  To determine
  3272. the exact requirement refer to the CCB Sizes section of this document.
  3273.  
  3274. Result codes    aspBufTooSmall    Reply is bigger than response buffer,
  3275.                                   or Replysize is bigger than ReplyBuffsize
  3276.                 aspNoServer       No response from server at address used
  3277.                                   in call
  3278.  
  3279. æKY AFPCommand
  3280. æFp AppleTalk.p
  3281. æT FUNCTION
  3282. æD FUNCTION AFPCommand(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3283. æDT myVariable := AFPCommand(thePBptr,async);
  3284. æRI V-542
  3285. æC 
  3286. »AFPCall Function
  3287.  
  3288. The AFPCall function can have one of the following command formats.
  3289.  
  3290.   •  General
  3291.   •  Login
  3292.   •  AFPWrite
  3293.   •  AFPRead
  3294.  
  3295. »General Command Format
  3296.  
  3297. FUNCTION AFPCommand (xParamBlock: XPPParmBlkPtr; async: BOOLEAN) : OSErr;
  3298.  
  3299. Parameter block
  3300.   -->    18    cmdResult   long word  AFP command result
  3301.   -->    26    csCode      word       Always AFPCall
  3302.   -->    28    sessRefnum  word       Session reference number
  3303.   -->    30    aspTimeout  byte       Retry interval in seconds
  3304.   -->    32    cbSize      word       Command buffer size
  3305.   -->    34    cbPtr       pointer    Command buffer
  3306.   <->    38    rbSize      word       Reply buffer size and reply size
  3307.   -->    40    rbPtr       pointer    Reply buffer pointer
  3308.   <->    44    wdSize      word       Write data size
  3309.   -->    46    wdPtr       pointer    Write data pointer
  3310.   -->    50    ccbStart    record     Start of memory for CCB
  3311.  
  3312. The general command format for the AFPCall function passes an AFP command to the
  3313. server.  This format is used for all AFP calls except AFPLogin, AFPRead, and AFPWrite.
  3314.   Note that from Pascal this call is referred to as AFPCommand.
  3315.  
  3316. CmdResult is four bytes of data returned from the server containing an indication of
  3317. the result of the AFP command.
  3318.  
  3319. SessRefnum is the session reference number returned in the AFPLogin call.
  3320.  
  3321. ASPTimeOut is the interval in seconds between retries of the call by the driver.
  3322.  
  3323. CBSize is the size in bytes of the block of data that contains the command to be sent
  3324. to the server on the session. The size of the command block must not exceed the value
  3325. of aspMaxCmdSize returned by the ASPGetParms call.
  3326.  
  3327. CBPtr points to start of the block of data (command block) containing the command
  3328. that is to be sent to the server on the session.  The first byte of the command block
  3329. must contain the AFP command byte.  Subsequent bytes in the command buffer contain
  3330. the  parameters associated with the command as defined in the AFP document.
  3331.  
  3332. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3333. command. RBSize is also returned and indicates the size of the reply that was actually
  3334. returned.
  3335.  
  3336. RBPtr points to the reply buffer.
  3337.  
  3338. WDSize is the size of data to be written to the server (only used if the command is
  3339. one that is mapped to an ASPUserWrite).
  3340.  
  3341. WDPtr points to the write data buffer (only used if the command is one that is mapped
  3342. to an ASPUserWrite).
  3343.  
  3344. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3345. control block.  The size of this block is equal to a maximum of 296 bytes.  To determine
  3346. the exact requirement refer to the CCB Sizes section of this document.
  3347.  
  3348. Result codes    aspParamErr       Invalid session number; session has
  3349.                                   been closed
  3350.                 aspSizeErr        Command block size is bigger than MaxCmdSize
  3351.                 aspSessClosed     Session is closing
  3352.                 aspBufTooSmall    Reply is bigger than response buffer or
  3353.                                   buffer will be filled, data will be truncated
  3354.                 afpParmError      AFP command block size is equal to zero.
  3355.                                   This error will also be returned if the
  3356.                                   command byte in the command block is equal
  3357.                                   to 0 or $FF (255) or GetSrvrStatus (15).
  3358.  
  3359. »Login Command Format
  3360.  
  3361. The AFP login command executes a series of AFP operations as defined in the AFP Draft
  3362. Proposal.  For further information, refer to the AFP document.
  3363.  
  3364. FUNCTION AFPCommand (xParamBlock: XPPParmBlkPtr; async: BOOLEAN): OSErr;
  3365.  
  3366. Parameter block
  3367.   -->    18    cmdResult       long word  AFP command result
  3368.   -->    26    csCode          word       Always AFPCall
  3369.   -->    28    sessRefnum      word       Session reference number
  3370.   -->    30    aspTimeout      byte       Retry interval in seconds
  3371.   -->    31    aspRetry        byte       Number of retries
  3372.   -->    32    cbSize          word       Command buffer size
  3373.   -->    34    cbPtr           pointer    Command buffer
  3374.   <->    38    rbSize          word       Reply buffer size and reply size
  3375.   -->    40    rbPtr           pointer    Reply buffer pointer
  3376.   -->    44    afpAddrBlock    long word  Server address block
  3377.   <->    48    afpSCBPtr       pointer    SCB pointer
  3378.   <->    52    afpAttnRoutine  pointer    Attention routine pointer
  3379.   -->    50    ccbStart        record     Start of command control block
  3380.  
  3381. CmdResult is four bytes of data returned from the server containing an indication of
  3382. the result of the AFP command.
  3383.  
  3384. SessRefnum is the session reference number (returned by the AFPLogin call).
  3385.  
  3386. ASPTimeOut is the interval in seconds between retries of the call.
  3387.  
  3388. ASPRetry is the number of retries that will be attempted.
  3389.  
  3390. CBSize is the size in bytes of the block data that contains the command to be sent to
  3391. the server on the session. The size of the command block must not exceed the value of
  3392. aspMaxCmdSize returned by the ASPGetParms call.
  3393.  
  3394. CBPtr points to the block of data (command block) containing the AFP login command
  3395. that is to be sent to the server on the session.  The first byte of the command block
  3396. must be the AFP login command byte.  Subsequent bytes in the command buffer contain
  3397. the parameters associated with the command.
  3398.  
  3399. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3400. command.  RBSize is also returned and indicates the size of the reply that was actually
  3401. returned.
  3402.  
  3403. RBPtr points to the reply buffer.
  3404.  
  3405. AFPServerAddr is the network identifier or address of the socket on which the server
  3406. is listening.
  3407.  
  3408. AFPSCBPointer points to a locked block of data for the session control block
  3409. (SCB). The SCB size is defined by scbMemSize.  The SCB is a locked block, and as long
  3410. as the session is open, the SCB cannot be modified in any way by the application. 
  3411. There is one SCB for each open session.
  3412.  
  3413. AFPAttnRoutine is a pointer to a routine that is invoked if an attention from the
  3414. server is received.  When afpAttnRoutine is equal to zero, no attention routine will
  3415. be invoked.
  3416.  
  3417. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3418. control block.  The size of this block is equal to a maximum of 150 bytes.  To determine
  3419. the exact requirement refer to the CCB Sizes section later in this chapter.
  3420.  
  3421. Note:  In the parameter block, the afpSCBPointer and the afpAttnRoutine
  3422.        fields overlap with the start of the CCB and are modified by the call.
  3423.  
  3424. Result codes    aspSizeErr        Command block size is bigger than MaxCmdSize
  3425.                 aspBufTooSmall    Reply is bigger than response buffer or
  3426.                                   buffer will be filled, data will be truncated
  3427.                 aspNoServer       Server not responding
  3428.                 aspServerBusy     Server cannot open another session
  3429.                 aspBadVersNum     Server cannot support the offered ASP
  3430.                                   version number
  3431.                 aspNoMoreSess     Driver cannot support another session.
  3432.  
  3433.  
  3434. »AFPWrite Command Format
  3435.  
  3436. The AFPWrite and AFPRead command formats allow the calling application to make AFP-level
  3437. calls that read or write a data block that is larger than a single ASP-level call is
  3438. capable of reading or writing.  The maximum number of bytes of data that can be read
  3439. or written at the ASP level is equal to quantumSize.
  3440.  
  3441. FUNCTION AFPCommand (xParamBlock: XPPParmBlkPtr; async: BOOLEAN) : OSErr;
  3442.  
  3443. Parameter block
  3444.   -->    18    cmdResult   long word  AFP command result
  3445.   -->    26    csCode      word       Always AFPCall
  3446.   -->    28    sessRefnum  word       Session number
  3447.   -->    30    aspTimeout  byte       Retry interval in seconds
  3448.   -->    32    cbSize      word       Command buffer size
  3449.   -->    34    cbPtr       pointer    Command buffer
  3450.   <->    38    rbSize      word       Reply buffer size and reply size
  3451.   -->    40    rbPtr       pointer    Reply buffer pointer
  3452.   -->    44    wdSize      word       (used internally)
  3453.   <->    46    wdPtr       pointer    Write data pointer  (updated)
  3454.   -->    50    ccbStart    record     Start of memory for CCB
  3455.  
  3456. CmdResult is four bytes of data returned from the server containing an indication of
  3457. the result of the AFP command.
  3458.  
  3459. SessRefnum is the session reference number returned in the AFPLogin call.
  3460.  
  3461. ASPTimeOut is the interval in seconds between retries of the call.
  3462.  
  3463. CBSize is the size in bytes of the block data that contains the command to be sent to
  3464. the server on the session.  The size of the command block must not exceed the value
  3465. of aspMaxCmdSize returned by the aspGetParms call.
  3466.  
  3467. CBPtr points to the block of data (see command block structure below) containing the
  3468. AFP write command that is to be sent to the server on the session.  The first byte of
  3469. the Command Block must contain the AFP write command byte.
  3470.  
  3471. RBSize is passed and indicates the size of the reply buffer in bytes expected by the
  3472. command.  RBSize is also returned and indicates the size of the reply that was actually
  3473. returned.
  3474.  
  3475. RBPtr points to the reply buffer.
  3476.  
  3477. WDSize is used internally.
  3478.  
  3479. Note:  This command does not pass the write data size in the queue element
  3480.        but in the command buffer.  XPP will look for the size in that buffer.
  3481.  
  3482. WDPtr is a pointer to the block of data to be written.  Note that this field will be
  3483. updated by XPP as it proceeds and will always point to that section of the data which
  3484. XPP is currently writing.
  3485.  
  3486. CCBStart is the start of the memory to be used by the XPP driver for the command
  3487. control block.  The size of this block is equal to a maximum of 296 bytes.  To determine
  3488. the exact requirement refer to the CCB Sizes section later in this chapter.
  3489.  
  3490. Command Block Structure:  The AFP write command passes several arguments to XPP in
  3491. the command buffer itself. The byte offsets are relative to the location pointed to
  3492. by cbPtr.
  3493.  
  3494.   -->    0    cmdByte       byte       AFP call command byte
  3495.   -->    1    startEndFlag  byte       Start/end Flag
  3496.   <->    4    rwOffset      long word  Offset within fork to write
  3497.   <->    8    reqCount      long word  Requested count
  3498.  
  3499. CmdByte is the AFP call command byte and must contain the AFP write command code.
  3500.  
  3501. StartEndFlag is a one-bit flag (the high bit of the byte) indicating whether the
  3502. rwOffset field is relative to the beginning or the end of the fork (all other bits
  3503. are zero).
  3504.  
  3505.   0 = relative to the beginning of the fork
  3506.   1 = relative to the end of the fork
  3507.  
  3508. RWOffset is the byte offset within the fork at which the write is to begin.
  3509.  
  3510. ReqCount indicates the size of the data to be written and is returned as the actual
  3511. size written.
  3512.  
  3513. The rwOffset and reqCount fields are modified by XPP as the write proceeds and will
  3514. always indicate the current value of these fields.
  3515.  
  3516. The Pascal structure of the AFP command buffer follows:
  3517.  
  3518. AFPCommandBlock = PACKED RECORD
  3519.                     cmdByte:       Byte;
  3520.                     startEndFlag:  Byte;
  3521.                     forkRefNum:    INTEGER;    {used by server}
  3522.                     rwOffset:      LONGINT;
  3523.                     reqCount:      LONGINT;
  3524.                     newLineFlag:   Byte;       {unused by write}
  3525.                     newLineChar:   CHAR;       {unused by write}
  3526.                   END;
  3527.  
  3528. Result codes    aspParamErr       Invalid session number
  3529.                 aspSizeErr        Command block size is bigger than MaxCmdSize
  3530.                 aspSessClosed     Session is closing
  3531.                 aspBufTooSmall    Reply is bigger than response buffer
  3532.  
  3533. »AFPRead Command Format
  3534.  
  3535. The AFPWrite and AFPRead command formats allow the calling application to make AFP-level
  3536. calls that read or write a data block that is larger than a single ASP-level call is
  3537. capable of reading or writing.  The maximum number of bytes of data that can be read
  3538. or written at the ASP level is equal to quantumSize.
  3539.  
  3540. FUNCTION AFPCommand (xParamBlock: XPPParmBlkPtr; async: BOOLEAN) : OSErr;
  3541.  
  3542. Parameter block
  3543.   -->    18    cmdResult   long word  ASP command result
  3544.   -->    26    csCode      word       Always AFPCall
  3545.   -->    28    sessRefnum  word       Session number
  3546.   -->    30    aspTimeout  byte       Retry interval in seconds
  3547.   -->    32    cbSize      word       Command buffer size
  3548.   -->    34    cbPtr       pointer    Command buffer
  3549.   -->    38    rbSize      word       Used internally
  3550.   <->    40    rbPtr       pointer    Reply buffer pointer (updated)
  3551.   -->    50    ccbStart    record     Start of memory for CCB
  3552.  
  3553. CmdResult is four bytes of data returned from the server containing an indication of
  3554. the result of the AFP command.
  3555.  
  3556. SessRefnum is the session reference number returned in the AFPLogin  call.
  3557.  
  3558. ASPTimeOut is the interval in seconds between retries of the call.
  3559.  
  3560. CBSize is the size in bytes of the block data that contains the command to be sent to
  3561. the server on the session.  The size of the command block must not exceed the value
  3562. of aspMaxCmdSize returned by the GetParms call.
  3563.  
  3564. CBPtr points to the block of data (command block) containing the AFP read command
  3565. that is to be sent to the server on the session.  The first byte of the command block
  3566. must contain the AFP read command byte.  The command block structure is shown below.
  3567.  
  3568. RBSize  is used internally.
  3569.  
  3570. Note:  This command does not pass the read size in the queue element but
  3571.        in the command buffer.  XPP will look for the size in that buffer.
  3572.  
  3573. RBPtr points to the reply buffer.  Note that this field will be updated by XPP as it
  3574. proceeds and will always point to that section of the buffer that XPP is currently
  3575. reading into.
  3576.  
  3577. CCBStart is the start of the memory to be used by the .XPP driver for the command
  3578. control block.  The size of this block is equal to a maximum of 150 bytes.  To determine
  3579. the exact requirement refer to The CCB Sizes section later in this chapter.
  3580.  
  3581. Command Block Structure:  The AFP read command passes several arguments to XPP in the
  3582. command buffer itself. The byte offsets are relative to the location pointed to by
  3583. cbPointer.
  3584.  
  3585.   -->    0    cmdByte      byte       AFP call command byte
  3586.   <->    4    rwOffset     long word  Offset within fork to read
  3587.   <->    8    reqCount     long word  Requested count
  3588.   -->    12   newLineFlag  byte       Newline Flag
  3589.   -->    13   newLineChar  byte       Newline Character
  3590.  
  3591. CmdByte is the AFP call command byte and must contain the AFP read command code.
  3592.  
  3593. RWOffset is the byte offset within the fork at which the read is to begin.
  3594.  
  3595. ReqCount  indicates the size of the read data buffer and is returned as the actual
  3596. size read.
  3597.  
  3598. The rwOffset and reqCount fields are modified by XPP as the read proceeds and will
  3599. always indicate the current value of these fields.
  3600.  
  3601. NewLineFlag is a one-bit flag (the high bit of the byte) indicating whether or not
  3602. the read is to terminate at a specified character (all other bits are zero).
  3603.  
  3604.   0 = no Newline Character is specified
  3605.   1 = a Newline Character is specified
  3606.  
  3607. NewLineChar is any character from $00 to $FF (inclusive) that, when encountered in
  3608. reading the fork, causes the read operation to terminate.
  3609.  
  3610. The Pascal structure of the AFPCommand follows:
  3611.  
  3612. AFPCommandBlock = PACKED RECORD
  3613.                     cmdByte:       Byte;
  3614.                     startEndFlag:  Byte;     {unused for read}
  3615.                     forkRefNum:    INTEGER;  {used by server}
  3616.                     rwOffset:      LONGINT;
  3617.                     reqCount:      LONGINT;
  3618.                     newLineFlag:   Byte;
  3619.                     newLineChar:   CHAR;
  3620.                   END;
  3621.  
  3622. Result codes    aspParamErr       Invalid session number
  3623.                 aspSizeErr        Command block size is bigger than MaxCmdSize
  3624.                 aspSessClosed     Session is closing
  3625.                 aspBufTooSmall    Reply is bigger than response buffer
  3626.  
  3627.         
  3628.  
  3629. æKY GetLocalZones
  3630. æFp AppleTalk.p
  3631. æT FUNCTION
  3632. æD FUNCTION GetLocalZones(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3633. æDT myVariable := GetLocalZones(thePBptr,async);
  3634. æRI VI
  3635. æC 
  3636. Parameter block
  3637.   ¨  16  ioResult  word  result code 
  3638.   Æ  26  csCode  word  routine selector; always xCall
  3639.   Æ  28  xppSubCode  word  routine selector; getLocalZones
  3640.   Æ  30  xppTimeOut  byte  retry interval in seconds
  3641.   Æ  31  xppRetry  byte  retry count
  3642.   Æ  34  zipBuffPtr  pointer  pointer to data buffer
  3643.   ¨  38  zipNumZones  word  number of names returned
  3644.   ¨  40  zipLastFlag  byte  nonzero if no more names
  3645.   Æ  42  zipInfoField  70 bytes  for use by ZIP; first word set to 0
  3646.  
  3647. The GetLocalZones function returns a list of all the zone names on the local
  3648. network; that is, the network that includes the node on which your application
  3649. is running.
  3650.  
  3651. The ioResult parameter returns the result of the function; if you call the
  3652. function asynchronously, the function sets this field to 1 as soon as it begins
  3653. execution, and changes the field to the actual result code when it completes
  3654. execution. The csCode and xppSubCode parameters are routine selectors and are
  3655. automatically set by the MPW interface to xCall and getLocalZones for this
  3656. function. The xppTimeOut field specifies the amount of time, in seconds, that
  3657. the .ATP driver should wait between attempts to obtain the data. A value of 3 or
  3658. 4 for the xppTimeOut field generally gives good results. The xppRetry field
  3659. specifies the number of times the .ATP driver should attempt to obtain the data
  3660. before returning the ReqFailed (request failed) result code. A value of 3 or 4
  3661. for the xppRetry field usually works well.
  3662.  
  3663. The zipBuffPtr is a pointer to a 578-byte data buffer that you must allocate.
  3664. The Zone Information Protocol returns the zone names into this buffer as a
  3665. packed array of packed Pascal strings. The zipNumZones parameter returns the
  3666. number of zone names that ZIP placed in the data buffer. 
  3667.  
  3668. The .XPP driver sets the zipLastFlag field to 1 if there are no more zone names
  3669. for your network. If the zipLastFlag field is still 0 when the GetLocalZones
  3670. function has completed execution, you must empty the data buffer pointed to by
  3671. the zipBuffPtr parameter and immediately call the GetLocalZones function again
  3672. without changing the value in the zipInfoField parameter. The zipInfofield
  3673. parameter is a 70-byte data buffer that you must allocate for use by ZIP. You
  3674. must set the first word of this buffer to 0 before you call the GetLocalZones
  3675. function the first time, and not change the contents of this field thereafter.
  3676.  
  3677.         
  3678.  
  3679. æKY GetZoneList
  3680. æFp AppleTalk.p
  3681. æT FUNCTION
  3682. æD FUNCTION GetZoneList(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3683. æDT myVariable := GetZoneList(thePBptr,async);
  3684. æRI VI
  3685. æC 
  3686. Parameter block
  3687.   ¨  16  ioResult  word  result code 
  3688.   Æ  26  csCode  word  routine selector; always xCall
  3689.   Æ  28  xppSubCode  word  routine selector; getZoneList
  3690.   Æ  30  xppTimeOut  byte  retry interval in seconds
  3691.   Æ  31  xppRetry  byte  retry count
  3692.   Æ  34  zipBuffPtr  pointer  pointer to data buffer
  3693.   ¨  38  zipNumZones  word  number of names returned
  3694.   ¨  40  zipLastFlag  byte  nonzero if no more names
  3695.   Æ  42  zipInfoField  70 bytes  for use by ZIP; first word set to 0
  3696.  
  3697. The GetZoneList function returns a complete list of all the zone names on the
  3698. internet. Use the GetLocalZones function to obtain a list of only the zone names
  3699. on the local network. 
  3700.  
  3701. The ioResult parameter returns the result of the function; if you call the
  3702. function asynchronously, the function sets this field to 1 as soon as it begins
  3703. execution, and changes the field to the actual result code when it completes
  3704. execution. The csCode and xppSubCode parameters are routine selectors and are
  3705. automatically set by the MPW interface to xCall and getZoneList for this
  3706. function. The xppTimeOut field specifies the amount of time, in seconds, that
  3707. the .ATP driver should wait between attempts to obtain the data. A value of 3 or
  3708. 4 for the xppTimeOut field generally gives good results. The xppRetry field
  3709. specifies the number of times the .ATP driver should attempt to obtain the data
  3710. before returning the ReqFailed (request failed) result code. A value of 3 or 4
  3711. for the xppRetry field usually works well.
  3712.  
  3713. The zipBuffPtr is a pointer to a 578-byte data buffer that you must allocate.
  3714. The Zone Information Protocol returns the zone names into this buffer as Pascal
  3715. strings. The zipNumZones parameter returns the number of zone names that ZIP
  3716. placed in the data buffer. 
  3717.  
  3718. The .XPP driver sets the zipLastFlag field to 1 if there are no more zone names
  3719. for the internet. If the zipLastFlag field is still 0 when the GetZoneList
  3720. function has completed execution, you must empty the data buffer pointed to by
  3721. the zipBuffPtr parameter and immediately call the GetZoneList function again
  3722. without changing the value in the zipInfoField parameter. The zipInfofield
  3723. parameter is a 70-byte data buffer that you must allocate for use by ZIP. You
  3724. must set the first word of this buffer to 0 before you call the GetZoneList
  3725. function the first time, and not change the contents of this field thereafter.
  3726.  
  3727.         
  3728.  
  3729. æKY GetMyZone
  3730. æFp AppleTalk.p
  3731. æT FUNCTION
  3732. æD FUNCTION GetMyZone(thePBptr: XPPParmBlkPtr;async: BOOLEAN): OSErr;
  3733. æDT myVariable := GetMyZone(thePBptr,async);
  3734. æRI VI
  3735. æC 
  3736. The .XPP driver provides three functions that obtain information about zones.
  3737. All three functions use the Zone Information Protocol to return the names of
  3738. zones: The GetMyZone function returns the AppleTalk zone name of the node on
  3739. which your application is running; the GetLocalZones function returns a list of
  3740. zone names on the network that includes the node on which your application is
  3741. running; and the GetZoneList function returns a complete list of zones on the
  3742. internet.
  3743.  
  3744. Assembly-language note:  The .XPP driver functions all use the same value
  3745. (xCall, which is equal to 246) for the csCode parameter to the xCallParam
  3746. parameter block. The xCall routine uses the value of the xppSubCode parameter to
  3747. distinguish between the functions, as follows:
  3748.  
  3749. Function        xppSubCode      Value
  3750. GetMyZone       getMyZone       7
  3751. GetLocalZones   getLocalZones   5
  3752. GetZoneList     getZoneList     6
  3753.  
  3754. FUNCTION GetMyZone (thePBptr:XCallParamPtr; async: BOOLEAN) : OSErr;
  3755.  
  3756. Parameter block
  3757.   ¨  16  ioResult  word  result code 
  3758.   Æ  26  csCode  word  routine selector; always xCall
  3759.   Æ  28  xppSubCode  word  routine selector; getMyZone
  3760.   Æ  30  xppTimeOut  byte  retry interval in seconds
  3761.   Æ  31  xppRetry  byte  retry count
  3762.   Æ  34  zipBuffPtr  long  pointer to data buffer
  3763.   Æ  42  zipInfoField  70 bytes  for use by ZIP; first word set to 0
  3764.  
  3765. The GetMyZone function returns only the zone name of the node on which your
  3766. application is running.
  3767.  
  3768. The ioResult parameter returns the result of the function; if you call the
  3769. function asynchronously, the function sets this field to 1 as soon as it begins
  3770. execution, and changes the field to the actual result code when it completes
  3771. execution. The csCode and xppSubCode parameters are routine selectors and are
  3772. automatically set by the MPW interface to xCall and getMyZone for this function.
  3773. The xppTimeOut field specifies the amount of time, in seconds, that the .ATP
  3774. driver should wait between attempts to obtain the data. A value of 3 or 4 for
  3775. the xppTimeOut field generally gives good results. The xppRetry field specifies
  3776. the number of times the .ATP driver should attempt to obtain the data before
  3777. returning the ReqFailed (request failed) result code. A value of 3 or 4 for the
  3778. xppRetry field usually works well.
  3779.  
  3780. The zipBuffPtr is a pointer to a 33-byte data buffer that you must allocate. The
  3781. Zone Information Protocol returns the zone name into this buffer as a Pascal
  3782. string. The zipInfo field is a 70-byte data buffer that you must allocate for
  3783. use by ZIP. You must set the first word of this buffer to 0 before you call the
  3784. GetMyZone function.
  3785.  
  3786. Result codes
  3787. noErr          0  no error
  3788. noBridgeErr  –93  no router is available
  3789. reqFailed  –1096  Request to contact router failed; retry count exceeded 
  3790.  
  3791.         
  3792.  
  3793. æKY PAttachPH
  3794. æFp AppleTalk.p
  3795. æT FUNCTION
  3796. æD FUNCTION PAttachPH(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3797. æDT myVariable := PAttachPH(thePBptr,async);
  3798. æRI II-308, V-513
  3799. æC AttachPH function
  3800.  
  3801. Parameter block
  3802.     ->  26  csCode        word     ;always attachPH
  3803.     ->  28  protType      byte     ;ALAP protocol type
  3804.     ->  30  handler       pointer  ;protocol handler
  3805.  
  3806. AttachPH adds the protocol handler pointed to by handler to the node's protocol 
  3807. table.  ProtType specifies what kind of frame the protocol handler can service.  
  3808.  
  3809. After AttachPH is called, the protocol handler is called for each incoming frame 
  3810. whose ALAP protocol type equals protType.
  3811.  
  3812. Result codes    
  3813.  
  3814.    noErr         No error
  3815.    lapProtErr    Error attaching protocol type
  3816.  
  3817. æKY PDetachPH
  3818. æFp AppleTalk.p
  3819. æT FUNCTION
  3820. æD FUNCTION PDetachPH(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3821. æDT myVariable := PDetachPH(thePBptr,async);
  3822. æRI II-308, V-513
  3823. æC DetachPH function
  3824.  
  3825. Parameter block
  3826.     ->  26  csCode      word      ;always detachPH
  3827.     ->  28  protType    byte      ;ALAP protocol type
  3828.  
  3829. DetachPH removes from the node's protocol table the specified ALAP protocol type 
  3830. and corresponding protocol handler.
  3831.  
  3832. Result codes    
  3833.  
  3834.    noErr           No error
  3835.    lapProtErr      Error detaching protocol type
  3836.  
  3837. æKY PWriteLAP
  3838. æFp AppleTalk.p
  3839. æT FUNCTION
  3840. æD FUNCTION PWriteLAP(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3841. æDT myVariable := PWriteLAP(thePBptr,async);
  3842. æRI II-307, V-513
  3843. æC WriteLAP function
  3844.  
  3845. Parameter block
  3846.  
  3847.     ->  26  csCode          word       ;always writeLAP
  3848.     ->  30  wdsPointer      pointer    ;write data structure
  3849.  
  3850. WriteLAP sends a frame to another node.  The frame data and destination of the 
  3851. frame are described by the write data structure pointed to by wdsPointer.  The 
  3852. first two data bytes of an ALAP frame sent to another computer using the 
  3853. AppleTalk Manager must indicate the length of the frame in bytes.  The ALAP 
  3854. protocol type byte must be in the range 1 to 127.
  3855.  
  3856. Result codes    
  3857.  
  3858.       noErr          No error
  3859.       excessCollsns  No CTS received after 32 RTS's
  3860.       ddpLengthErr   Packet length exceeds maximum
  3861.       lapProtErr     Invalid ALAP protocol type
  3862.  
  3863. æKY POpenSkt
  3864. æFp AppleTalk.p
  3865. æT FUNCTION
  3866. æD FUNCTION POpenSkt(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3867. æDT myVariable := POpenSkt(thePBptr,async);
  3868. æRI II-311, V-513
  3869. æC OpenSkt function
  3870.  
  3871. Parameter block
  3872.  
  3873.     ->  26  csCode      word         ;always openSkt
  3874.     <-> 28  socket      byte         ;socket number
  3875.     ->  30  listener    pointer      ;socket listener
  3876.  
  3877. OpenSkt adds a socket and its socket listener to the socket table.  If the socket 
  3878. parameter is nonzero, it must be in the range 64 to 127, and it specifies the 
  3879. socket's number; if socket is 0, OpenSkt opens a socket with a socket number in the 
  3880. range 128 to 254, and returns it in the socket parameter.  Listener contains a 
  3881. pointer to the socket listener.
  3882.  
  3883. OpenSkt will return ddpSktErr if you pass the number of an already opened socket, 
  3884. if you pass a socket number greater than 127, or if the socket table is full (the 
  3885. socket table can hold a maximum of 12 sockets).
  3886.  
  3887. Result codes    
  3888.  
  3889.    noErr         No error
  3890.    ddpSktErr     Socket error
  3891.  
  3892. æKY PCloseSkt
  3893. æFp AppleTalk.p
  3894. æT FUNCTION
  3895. æD FUNCTION PCloseSkt(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3896. æDT myVariable := PCloseSkt(thePBptr,async);
  3897. æRI II-312,V513
  3898. æC CloseSkt function
  3899.  
  3900. Parameter block
  3901.  
  3902.     ->  26  csCode  word    ;always closeSkt
  3903.     ->  28  socket  byte    ;socket number
  3904.  
  3905. CloseSkt removes the entry of the specified socket from the socket table.  If you 
  3906. pass a socket number of 0, or if you attempt to close a socket that isn't open, 
  3907. CloseSkt will return ddpSktErr.
  3908.  
  3909. Result codes    
  3910.  
  3911.    noErr      No error
  3912.    ddpSktErr  Socket error
  3913.  
  3914. æKY PWriteDDP
  3915. æFp AppleTalk.p
  3916. æT FUNCTION
  3917. æD FUNCTION PWriteDDP(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3918. æDT myVariable := PWriteDDP(thePBptr,async);
  3919. æRI II-312,V-513
  3920. æC WriteDDP function
  3921.  
  3922. Parameter block
  3923.  
  3924.     ->  26  csCode            word        ;always writeDDP
  3925.     ->  28  socket            byte        ;socket number
  3926.     ->  29  checksumFlag      byte        ;checksum flag
  3927.     ->  30  wdsPointer        pointer     ;write data structure
  3928.  
  3929. WriteDDP sends a datagram to another socket.  WDSPointer points to a write data 
  3930. structure containing the datagram and the address of the destination socket.  If 
  3931. checksumFlag is TRUE, WriteDDP will compute the checksum for all datagrams 
  3932. requiring long headers.
  3933.  
  3934. Result codes    
  3935.  
  3936.       noErr          No error
  3937.       ddpLenErr      Datagram length too big
  3938.       ddpSktErr      Socket error
  3939.       noBridgeErr    No bridge found 
  3940.  
  3941. æKY PRegisterName
  3942. æFp AppleTalk.p
  3943. æT FUNCTION
  3944. æD FUNCTION PRegisterName(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3945. æDT myVariable := PRegisterName(thePBptr,async);
  3946. æRI II-322,V-513
  3947. æC RegisterName function
  3948.  
  3949. Parameter block
  3950.  
  3951.     ->  26  csCode         word          ;always registerName
  3952.     ->  28  interval       byte          ;retry interval
  3953.     <-> 29  count          byte          ;retry count
  3954.     ->  30  ntQElPtr       pointer       ;names table element pointer 
  3955.     ->  34  verifyFlag     byte          ;set if verify needed 
  3956.  
  3957. RegisterName adds the name and address of an entity to the node's names table.  
  3958. NTQElPtr points to a names table entry containing the entity's name and internet 
  3959. address (in the form shown in Figure 13 above).  Meta-characters aren't allowed in 
  3960. the object and type fields of the entity name; the zone field, however, must contain 
  3961. the meta-character "*".  If verifyFlag is TRUE, RegisterName checks on the network 
  3962. to see if the name is already in use, and returns a result code of nbpDuplicate 
  3963. if so.  
  3964.  
  3965. Interval and count contain the retry interval in eight-tick units and the 
  3966. retry count.  
  3967. When a retry is made, the count field is modified.
  3968.  
  3969. Warning:  The names table entry passed to RegisterName remains the 
  3970.           property of NBP until removed from the names table.  Don't attempt to remove 
  3971.           or modify it.  If you've allocated memory using a NewHandle call, you must 
  3972.           lock it as long as the name is registered. 
  3973.  
  3974. Warning:  VerifyFlag should normally be set before calling RegisterName.
  3975.  
  3976. Result codes    
  3977.  
  3978.    noErr          No error
  3979.    nbpDuplicate   Duplicate name already exists
  3980.    nbpNISErr      Error opening names information socket 
  3981.  
  3982. æKY PLookupName
  3983. æFp AppleTalk.p
  3984. æT FUNCTION
  3985. æD FUNCTION PLookupName(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  3986. æDT myVariable := PLookupName(thePBptr,async);
  3987. æRI II-323,V-513
  3988. æC LookupName function
  3989.  
  3990. Parameter block
  3991.  
  3992.     ->   26 csCode        word      ;always lookupName
  3993.     ->   28 interval      byte      ;retry interval
  3994.     <->  29 count         byte      ;retry count
  3995.     ->   30 entityPtr     pointer   ;pointer to entity name
  3996.     ->   34 retBuffPtr    pointer   ;pointer to buffer
  3997.     ->   38 retBuffSize   word      ;buffer size in bytes
  3998.     ->   40 maxToGet      word      ;matches to get
  3999.     <->  42 numGotten     word      ;matches found 
  4000.  
  4001. LookupName returns the addresses of all entities with a specified name.  EntityPtr 
  4002. points to the entity's name (in the form shown in Figure 13 above).  Meta-
  4003. characters are allowed in the entity name.  RetBuffPtr and retBuffSize contain the 
  4004. location and size of an area of memory in which the tuples describing the entity 
  4005. names and their corresponding addresses should be returned.  MaxToGet indicates 
  4006. the maximum number of matching names to find addresses for; the actual number of 
  4007. addresses found is returned in numGotten.  Interval and count contain the retry 
  4008. interval and the retry count.  LookupName completes when either the number of 
  4009. matches is equal to or greater than maxToGet, or the retry count has been exceeded.  
  4010. The count field is decremented for each retransmission.
  4011.  
  4012. Note:  NumGotten is first set to 0 and then incremented with each match 
  4013.        found.  You can test the value in this field, and can start examining the 
  4014.        received addresses in the buffer while the lookup continues.
  4015.  
  4016. Result codes    
  4017.  
  4018.    noErr           No error
  4019.    nbpBuffOvr      Buffer overflow
  4020.  
  4021. æKY PConfirmName
  4022. æFp AppleTalk.p
  4023. æT FUNCTION
  4024. æD FUNCTION PConfirmName(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4025. æDT myVariable := PConfirmName(thePBptr,async);
  4026. æRI II-323,V-513
  4027. æC ConfirmName function
  4028.  
  4029. Parameter block
  4030.  
  4031.     ->   26 csCode            word         ;always confirmName
  4032.     ->   28 interval          byte         ;retry interval
  4033.     <->  29  count            byte         ;retry count
  4034.     ->   30 entityPtr         pointer      ;pointer to entity name
  4035.     ->   34 confirmAddr       pointer      ;entity address
  4036.     <-   38 newSocket         byte         ;socket number
  4037.  
  4038. ConfirmName confirms that an entity known by name and address still exists (is 
  4039. still entered in the names directory).  EntityPtr points to the entity's name (in the 
  4040. form shown in Figure 13 above).  ConfirmAddr specifies the address to confirmed.  
  4041.  
  4042. No meta-characters are allowed in the entity name.  Interval and count contain the 
  4043. retry interval and the retry count.  The socket number of the entity is returned in 
  4044. newSocket.  ConfirmName is more efficient than LookupName in terms of network 
  4045. traffic.
  4046.  
  4047. Result codes    
  4048.  
  4049.    noErr           No error
  4050.    nbpConfDiff     Name confirmed for different socket
  4051.    nbpNoConfirm    Name not confirmed
  4052.  
  4053. æKY PRemoveName
  4054. æFp AppleTalk.p
  4055. æT FUNCTION
  4056. æD FUNCTION PRemoveName(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4057. æDT myVariable := PRemoveName(thePBptr,async);
  4058. æRI II-324,V-513
  4059. æC RemoveName function
  4060.  
  4061. Parameter block
  4062.  
  4063.     ->  26  csCode       word        ;always removeName 
  4064.     ->  30  entityPtr    pointer     ;pointer to entity name 
  4065.  
  4066. RemoveName removes an entity name from the names table of the given entity's node.
  4067.  
  4068. Result codes    
  4069.  
  4070.    noErr            No error
  4071.    nbpNotFound      Name not found 
  4072.  
  4073. æKY PSetSelfSend
  4074. æFp AppleTalk.p
  4075. æT FUNCTION
  4076. æD FUNCTION PSetSelfSend(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4077. æDT myVariable := PSetSelfSend(thePBptr,async);
  4078. æRI V-516
  4079. æC  
  4080. _______________________________________________________________________________
  4081.  
  4082. »SENDING PACKETS TO ONE’S OWN NODE
  4083. _______________________________________________________________________________
  4084.  
  4085. Upon opening, the ability to send a packet to one’s own node (intranode delivery) is
  4086. disabled.  This feature of the AppleTalk Manager can be manipulated through the
  4087. SetSelfSend function.  Once enabled, it is possible, at all levels, to send packets
  4088. to entities within one’s own node.  An example of where this might be desirable is an
  4089. application sending data to a print spooler that is actually running in the background
  4090. on the same node.
  4091.  
  4092. Enabling (or disabling) this feature affects the entire node and should be performed
  4093. with care.  For instance, a desk accessory may not expect to receive names from
  4094. within its own node as a response to an NBP look-up;  enabling this feature from an
  4095. application could break the desk accessory.  All future programs should be written
  4096. with this feature in mind.
  4097.  
  4098. FUNCTION PSetSelfSend (thePBptr: MPPPBPtr; async: BOOLEAN) : OSErr;
  4099.  
  4100. Parameter Block
  4101.   -->    26    csCode         word    Always PSetSelfSend
  4102.   -->    28    newSelfFlag    byte    New SelfSend flag
  4103.   <--    29    oldSelfFlag    byte    Old SelfSend flag
  4104.  
  4105. PSetSelfSend enables or disables the intranode delivery feature of the AppleTalk
  4106. Manager.  If newSelfFlag is nonzero, the feature will be enabled; otherwise it will
  4107. be disabled.  The previous value of the flag will be returned in oldSelfFlag.
  4108.  
  4109. Result Codes    noErr        No error
  4110.  
  4111. æKY PKillNBP
  4112. æFp AppleTalk.p
  4113. æT FUNCTION
  4114. æD FUNCTION PKillNBP(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4115. æDT myVariable := PKillNBP(thePBptr,async);
  4116. æRI V-518
  4117. æC  
  4118. _______________________________________________________________________________
  4119.  
  4120. »NAME BINDING PROTOCOL CHANGES
  4121. _______________________________________________________________________________
  4122.  
  4123. Changes to the Name Binding Protocol include supporting multiple concurrent requests
  4124. and a means for aborting an active request.
  4125.  
  4126. »Multiple Concurrent NBP Requests
  4127.  
  4128. NBP now supports multiple concurrent active requests.  Specifically, a number of
  4129. LookupNames, RegisterNames and ConfirmNames can all be active concurrently.  The
  4130. maximum number of  concurrent requests is machine dependent; if it is exceeded the
  4131. error tooManyReqs will be returned.  Active requests can be aborted by the PKillNBP
  4132. call.
  4133.  
  4134. »KillNBP function
  4135.  
  4136. FUNCTION PKillNBP (thePBptr: ATPPBPtr; async: BOOLEAN) : OSErr;
  4137.  
  4138. •••Refer to Technical Note #199:•••
  4139.  
  4140. Parameter block
  4141.   -->    26    csCode    word     Always PKillNBP
  4142.   -->    28    aKillQEl  pointer  Pointer to queue element
  4143.  
  4144. PKillNBP is used to abort an outstanding LookupName, RegisterName or ConfirmName
  4145. request.  To abort one of these calls, place a pointer to the queue element of the
  4146. call to abort in a KillQEl and issue the PKillNBP call.  The call will be completed
  4147. with a ReqAborted error.
  4148.  
  4149. Result Codes    noErr          No error
  4150.                 cbNotFound     aKillQEl does not point to a valid
  4151.                                NBP queue element
  4152.  
  4153. æKY PGetAppleTalkInfo
  4154. æFp AppleTalk.p
  4155. æT FUNCTION
  4156. æD FUNCTION PGetAppleTalkInfo(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4157. æDT myVariable := PGetAppleTalkInfo(thePBptr,async);
  4158. æRI VI
  4159. æC  
  4160. You can use the PGetAppleTalkInfo function to obtain information about the .MPP
  4161. driver. In addition to the node ID and other information pointed to by the
  4162. ABusVars global variable (discussed in the AppleTalk Manager chapter of Volume
  4163. II), the PGetAppleTalkInfo function returns 
  4164.  
  4165.   •   a pointer to the .MPP driver’s device control entry data structure (DCE)
  4166.  
  4167.   •   configuration flags, which indicate the status of certain conditions that
  4168.       are set at startup
  4169.  
  4170.   •   a value (the selfSend flag) that indicates whether the node can send
  4171.       packets to itself
  4172.  
  4173.   •   the network number range for the network to which the node is attached
  4174.  
  4175.   •   the 8-bit node ID and 16-bit network number of the node
  4176.  
  4177.   •   the 8-bit node ID and 16-bit network number of the last router from which
  4178.       the node has heard
  4179.  
  4180.   •   the maximum capacities of the .MPP driver—such as the maximum number of
  4181.       protocol handlers and the maximum number of static sockets allowed by
  4182.       this driver
  4183.  
  4184.   •   a pointer to the registered names queue
  4185.  
  4186.   •   the node address of the node on the underlying data link (for example,
  4187.       the Ethernet hardware address)
  4188.  
  4189.   •   the node’s zone name
  4190.  
  4191. The data link address (for example, the Ethernet hardware address) and the zone
  4192. name are returned only for extended networks; that is, network types that allow
  4193. more than one network per cable. You must allocate memory for and provide
  4194. pointers to the data buffers into which the PGetAppleTalkInfo function returns
  4195. the data link address and zone name. You use the laLength parameter to specify
  4196. the length of the data link address you want returned; the function returns the
  4197. actual length of the data in the laLength parameter and returns the data in the
  4198. buffer you provide.
  4199.  
  4200. Note:  Always use the PGetAppleTalkInfo function to obtain information about the
  4201. .MPP driver. You can no longer rely on the validity of the global variables
  4202. described in the AppleTalk chapter of Inside Macintosh, Volume II.
  4203.  
  4204. FUNCTION PGetAppleTalkInfo (thePBptr: MPPPBPtr; async: BOOLEAN) : OSErr;
  4205.  
  4206. Parameter block
  4207.   ¨  16  ioResult  word  result code 
  4208.   Æ  26  csCode  word  always PGetAppleTalkInfo
  4209.   Æ  28  version  word  version of function
  4210.   ¨  30  varsPtr  pointer  pointer to MPP globals
  4211.   ¨  34  dcePtr  pointer  pointer to DCE for .MPP
  4212.   ¨  38  portID  word  port number 
  4213.   ¨  40  configuration  long  configuration flags
  4214.   ¨  44  selfSend  word  nonzero if self-send is enabled
  4215.   ¨  46  netLo  word  low value of the network range
  4216.   ¨  48  netHi  word  high value of the network range
  4217.   ¨  50  ourAddr  long  local 24-bit AppleTalk address
  4218.   ¨  54  routerAddr  long  24-bit address of router
  4219.   ¨  58  numOfPHs  word  max number of protocol handlers
  4220.   ¨  60  numOfSkts  word  max number of static sockets
  4221.   ¨  62  numNBPEs  word  max concurrent NBP requests
  4222.   ¨  64  ntQueue  pointer  pointer to registered name queue
  4223.   ´  68  laLength  word  length in bytes of data link address
  4224.           (extended networks only)
  4225.   Æ  70  linkAddr  pointer  pointer to data link address buffer
  4226.           (extended networks only)
  4227.   Æ  74  zoneName  pointer  pointer to zone name buffer
  4228.  
  4229. The PGetAppleTalkInfo function returns information about the .MPP driver. If the
  4230. node on which your program is running happens also to be running AppleTalk
  4231. Internet Router software in the background, there may be more than one set of 
  4232. .MPP global variables in RAM. To make sure you are obtaining information about
  4233. the .MPP driver that handles application software, always use the
  4234. PGetAppleTalkInfo function rather than the Device Manager’s PBControl function.
  4235. If you are using assembly language, or want to use the PBControl function, you
  4236. must use a device driver reference number of –10 for the .MPP driver.
  4237.  
  4238. Parameters
  4239.  
  4240. ioResult
  4241. The result of the function. When you execute the function asynchronously, the
  4242. function sets this parameter to 1 and returns a function result of noErr as soon
  4243. as the function begins execution. When the function completes execution, it sets
  4244. the ioResult parameter to the actual result code. 
  4245.  
  4246. csCode
  4247. Routine selector, automatically set by the MPW interface. Always equal to
  4248. PGetAppleTalkInfo for this function.
  4249.  
  4250. version
  4251. The version number of the PGetAppleTalkInfo function you are calling. For
  4252. version number 53 of the .MPP driver, this number is always 1.
  4253.  
  4254. varsPtr
  4255. A pointer to the MPP global variables. The MPP global variables are discussed in
  4256. “Protocol Handlers and Socket Listeners” in Chapter 10 of Volume II.
  4257.  
  4258. dcePtr
  4259. A pointer to the device control entry (DCE) data structure for the .MPP driver.
  4260. The DCE is described in the Device Manager chapters of Volumes II and V.
  4261.  
  4262. portID
  4263. The port number for the .MPP driver. The port number is always 0 unless you are
  4264. requesting information for an .MPP driver being used by a router.
  4265.  
  4266. configuration
  4267. A 32-bit long word of configuration flags. The following flags are currently
  4268. defined:
  4269.  
  4270. Bit  Flag       Description
  4271. 31   SrvAdrBit  TRUE (1) if the routine that opened the .MPP driver requested a
  4272. server node number. Server node numbers are described in the AppleTalk Manager
  4273. of Volume V. This flag indicates only that the server-node number was requested,
  4274. not that it was returned. Some AppleTalk devices, such as EtherTalk, do not
  4275. honor a request for a server-node number.
  4276.  
  4277. 30   RouterBit  TRUE (1) if an AppleTalk Internet Router was loaded at system
  4278. startup (that is, there's a router operating on the same node as your
  4279. application). A router can be loaded but not active.
  4280.  
  4281. 15   ExtendedBit  TRUE (1) if the node is on an extended network.
  4282.  
  4283. 7    BadZoneHintBit  TRUE (1) if the zone name of the node you are on was not
  4284. the same as the zone name stored in parameter RAM (sometimes referred to as the
  4285. zone name hint) when the .MPP driver was opened. If the zone name hint is
  4286. invalid, then the AppleTalk Manager uses the default zone for the network.
  4287.  
  4288. 6    OneZoneBit  TRUE (1) if only one zone is assigned to your extended network
  4289. or if you are not on an extended network.
  4290.  
  4291. selfSend
  4292. This parameter is nonzero if the ability of a node to send packets to itself is
  4293. enabled. Use the PSetSelfSend function, described in the AppleTalk Manager
  4294. chapter of Volume V, to enable or disable this feature.
  4295.  
  4296. netLo
  4297. The low value of the range of network numbers on the local cable. Only extended
  4298. networks can have a range of network numbers. For a nonextended network, this
  4299. parameter returns the network number.
  4300.  
  4301. netHi
  4302. The high value of the range of network numbers on the local cable. Only extended
  4303. networks can have a range of network numbers. For a nonextended network, this
  4304. parameter returns the network number.
  4305.  
  4306. ourAddr
  4307. The 24-bit AppleTalk network address of the node you are on. The least
  4308. significant byte of the longword is the node ID. The middle 16 bits are the
  4309. network number. The most significant byte of the longword is reserved for use by
  4310. Apple Computer, Inc. 
  4311.  
  4312. routerAddr
  4313. The 24-bit AppleTalk network address of the last router from which your node
  4314. heard traffic. The least significant byte of the longword is the node ID. The
  4315. middle 16 bits are the network number. The most significant byte of the longword
  4316. is reserved for use by Apple Computer, Inc. You should always use this address
  4317. when you want to communicate with a router.
  4318.  
  4319. numOfPHs
  4320. The maximum number of protocol handlers that this .MPP driver allows.
  4321.  
  4322. numOfSkts
  4323. The maximum number of statically assigned sockets that this .MPP driver allows.
  4324. Statically assigned sockets are described in Inside AppleTalk.
  4325.  
  4326. numNBPEs
  4327. The maximum number of concurrent requests to NBP that this .MPP driver allows. 
  4328.  
  4329. ntQueue
  4330. A pointer to the first entry in the names table for the local node. You can use
  4331. NBP routines to look up and register names in the names table. The names table
  4332. is described in “Name-Binding Protocol” in Chapter 10 of Volume II.
  4333.  
  4334. laLength
  4335. When you call the PGetAppleTalkInfo function on a node on an extended network,
  4336. you use this parameter to specify the number of bytes of the data link address
  4337. the function should place in the buffer pointed to by the LinkAddr parameter. If
  4338. you request more bytes than the total number of bytes in the address, then the
  4339. function returns in the laLength parameter the actual number of bytes it placed
  4340. in the buffer. If the address is longer than the size of the buffer, then the
  4341. PGetAppleTalkInfo function fills the buffer and returns in the laLength
  4342. parameter the actual length of the address, not the number of bytes returned.
  4343. The function does not return an error when the buffer is too large or too small
  4344. for the address.
  4345.  
  4346. linkAddr
  4347. A pointer to a buffer for the data link address returned for extended networks
  4348. only. You use the laLength parameter to specify the number of bytes of the
  4349. address that you want placed in this buffer. You must allocate a buffer large
  4350. enough to hold the number of bytes you specify. Speficy NIL for this parameter
  4351. if you do not want the function to provide a data-link address.
  4352.  
  4353. zoneName
  4354. A pointer to a buffer into which the PGetAppleTalkInfo function places the local
  4355. node’s zone name. You must allocate a buffer of at least 33 bytes to hold this
  4356. data, or specify NIL for the ZoneName parameter if you do not want to obtain the
  4357. zone name. This field is returned only if the node is on an extended network.
  4358.  
  4359. Result codes
  4360. noErr  0  no error
  4361.  
  4362. æKY PATalkClosePrep
  4363. æFp AppleTalk.p
  4364. æT FUNCTION
  4365. æD FUNCTION PATalkClosePrep(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4366. æDT myVariable := PATalkClosePrep(thePBptr,async);
  4367. æRI VI
  4368. æC  
  4369. Whereas it is unlikely that opening the .MPP driver will adversely affect
  4370. another program, an application should never close the .MPP driver, because
  4371. another program might be using it. Under certain circumstances, however, the
  4372. system might close the .MPP driver, provided no application objects. The system
  4373. uses the .MPP driver’s PATalkClosePrep function to inform each routine in the
  4374. AppleTalk Transition Queue that it intends to close the .MPP driver, giving each
  4375. routine in the queue the opportunity to deny permission to do so.
  4376.  
  4377. The system provides a pointer to a 255-byte buffer when it calls the
  4378. PATalkClosePrep function. If any routine in the AppleTalk Transition Queue
  4379. denies permission to close the .MPP driver, it places a name in the buffer and
  4380. returns control to the AppleTalk Manager. The name that the routine places in
  4381. the buffer should be the name of the application that placed the entry in the
  4382. queue. The PATalkClosePrep function then calls each routine in the AppleTalk
  4383. Transition Queue a second time to inform it that the request to close the .MPP
  4384. driver has been canceled. If any routine in the AppleTalk Transition Queue
  4385. denies permission to close the .MPP driver, the PATalkClosePrep function returns
  4386. the result code closeErr.
  4387.  
  4388. If any routine denies permission to close the .MPP driver, the system displays a
  4389. dialog box informing the user that another application is using the .MPP driver,
  4390. and showing the name that the AppleTalk Transition Queue routine placed in the
  4391. buffer. The dialog box gives the user the option of canceling the request to
  4392. close AppleTalk, or of closing AppleTalk anyway. 
  4393.  
  4394. Note:  If the user chooses to close AppleTalk despite the fact that an
  4395. application is using it, the system calls the MPPClose function. AppleTalk calls
  4396. each application in the AppleTalk Transition Queue again, this time informing it
  4397. that AppleTalk is about to close. In this case, your AppleTalk Transition Queue
  4398. routine must prepare for the imminent closing of AppleTalk; it cannot deny
  4399. permission to the MPPClose function.
  4400.   
  4401. FUNCTION PATalkClosePrep (thePBptr: MPPPBPtr; async: BOOLEAN) : OSErr;
  4402.  
  4403. Parameter block
  4404.   Æ  26  csCode  word  always PATalkClosePrep
  4405.   Æ      appName  pointer  buffer for name of application that denies request
  4406.  
  4407. The PATalkClosePrep function calls each routine listed in the AppleTalk
  4408. Transition Queue to request permission to close the .MPP driver. 
  4409. The routine that calls the PATalkClosePrep function must allocate a 255-byte
  4410. buffer and provide a pointer to it in the appName parameter. If a routine in the
  4411. AppleTalk Transition Queue denies permission to close the .MPP driver, that
  4412. routine places a name in the buffer pointed to by the appName parameter, and the
  4413. AppleTalk Manager calls each routine in the AppleTalk Transition Queue a second
  4414. time to inform it that the request to close the .MPP driver has been canceled.
  4415. The PATalkClosePrep function then returns the result code closeErr, indicating
  4416. that the calling routine may not close the .MPP driver. The csCode parameter is
  4417. a routine selector; it is always equal to PATalkClosePrep for this function.
  4418.  
  4419. Result codes
  4420. noErr       0  no error
  4421. closeErr  –24  permission to close .MPP driver was denied
  4422.  
  4423. æKY PCancelATalkClosePrep
  4424. æFp AppleTalk.p
  4425. æT FUNCTION
  4426. æD FUNCTION PCancelATalkClosePrep(thePBptr: MPPPBPtr;async: BOOLEAN): OSErr;
  4427. æDT myVariable := PCancelATalkClosePrep(thePBptr,async);
  4428. æRI VI
  4429. æC  
  4430. The system can use the PCancelATClosePrep function to undo the effects of the
  4431. PATalkClosePrep function. The system uses this function, for example, if some
  4432. condition prevents it from closing the .MPP driver even though each routine
  4433. listed in the AppleTalk Transition Queue gave permission to close it. When the
  4434. system calls the PCancelATClosePrep function, the AppleTalk Manager calls each
  4435. routine in the AppleTalk Transition Queue to inform it that the request to close
  4436. the .MPP driver has been canceled.
  4437.  
  4438. FUNCTION PCancelATClosePrep (thePBptr: MPPPBPtr; async: BOOLEAN) : OSErr;
  4439.  
  4440. Parameter block
  4441.   Æ  26  csCode  word  always PCancelATClosePrep 
  4442.  
  4443. The PCancelATClosePrep function undoes the effects of the PATalkClosePrep
  4444. function. The PCancelATClosePrep function calls each routine in the AppleTalk
  4445. Transition Queue to inform it that the request to close the .MPP driver has been
  4446. canceled. 
  4447.  
  4448. The operating system uses this function, for example, if some condition prevents
  4449. it from closing the .MPP driver even though each routine listed in the AppleTalk
  4450. Transition Queue gave permission to close it. 
  4451.  
  4452. The csCode parameter is a routine selector, always equal to PCancelATClosePrep
  4453. for this function.
  4454.  
  4455. Result codes
  4456. noErr  0  no error
  4457.  
  4458. æKY POpenATPSkt
  4459. æFp AppleTalk.p
  4460. æT FUNCTION
  4461. æD FUNCTION POpenATPSkt(thePBptr: ATPPBPtr;async: BOOLEAN): OSErr;
  4462. æDT myVariable := POpenATPSkt(thePBptr,async);
  4463. æRI II-315,V-513
  4464. æC OpenATPSkt function
  4465.  
  4466. Parameter block
  4467.  
  4468.     ->  26 csCode        word         ;always openATPSkt
  4469.     <-> 28  atpSocket    byte         ;socket number
  4470.     ->  30  addrBlock    long word    ;socket request specification
  4471.  
  4472. OpenATPSkt opens a socket for the purpose of receiving requests.  ATPSocket 
  4473. contains the socket number of the socket to open.  If it's 0, a number is dynamically 
  4474. assigned and returned in atpSocket.  AddrBlock contains a specification of the 
  4475. socket addresses from which requests will be accepted.  A 0 in the network number, 
  4476. node ID, or socket number field of addrBlock means that requests will be accepted 
  4477. from every network, node, or socket, respectively.
  4478.  
  4479. Result codes    
  4480.  
  4481.    noErr             No error
  4482.    tooManySkts       Too many responding sockets
  4483.    noDataArea        Too many outstanding ATP calls
  4484.  
  4485. æKY PCloseATPSkt
  4486. æFp AppleTalk.p
  4487. æT FUNCTION
  4488. æD FUNCTION PCloseATPSkt(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4489. æDT myVariable := PCloseATPSkt(thePBPtr,async);
  4490. æRI II-316,V-513
  4491. æC CloseATPSkt function
  4492.  
  4493. Parameter block
  4494.     ->  26  csCode     word ;always closeATPSkt
  4495.     ->  28  atpSocket   byte    ;socket number
  4496.  
  4497. CloseATPSkt closes the socket whose number is specified by atpSocket, for the 
  4498. purpose of receiving requests.
  4499.  
  4500. Result codes    
  4501.    noErr      No error
  4502.  
  4503. æKY PSendRequest
  4504. æFp AppleTalk.p
  4505. æT FUNCTION
  4506. æD FUNCTION PSendRequest(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4507. æDT myVariable := PSendRequest(thePBPtr,async);
  4508. æRI II-316,V-513
  4509. æC SendRequest function
  4510.  
  4511. Parameter block
  4512.  
  4513.     ->   18 userData         long word      ;user bytes
  4514.     <-   22 reqTID           word           ;transaction ID used in request
  4515.     ->   26 csCode           word           ;always sendRequest
  4516.     <-   28 currBitMap       byte           ;bit map
  4517.     <->  29 atpFlags         byte           ;control information
  4518.     ->   30 addrBlock        long word      ;destination socket address
  4519.     ->   34 reqLength        word           ;request size in bytes
  4520.     ->   36 reqPointer       pointer        ;pointer to request data
  4521.     ->   40 bdsPointer       pointer        ;pointer to response BDS
  4522.     ->   44 numOfBuffs       byte           ;number of responses expected
  4523.     ->   45 timeOutVal       byte           ;timeout interval
  4524.     <-   46 numOfResps       byte           ;number of responses received
  4525.     <->  47 retryCount       byte           ;number of retries
  4526.  
  4527. SendRequest sends a request to another socket and waits for a response.  UserData 
  4528. contains the four user bytes.  AddrBlock indicates the socket to which the request 
  4529. should be sent.  ReqLength and reqPointer contain the size and location of the 
  4530. request to send.  BDSPointer points to a response BDS where the responses are to be 
  4531. returned; numOfBuffs indicates the number of responses requested.  The number of 
  4532. responses received is returned in numOfResps.  If a nonzero value is returned in 
  4533. numOfResps, you can examine currBitMap to determine which packets of the 
  4534. transaction were actually received and to detect pieces for higher-level recovery, 
  4535. if desired.
  4536.  
  4537. TimeOutVal indicates the number of seconds that SendRequest should wait for a 
  4538. response before resending the request.  RetryCount indicates the maximum number 
  4539. of retries SendRequest should attempt.  The end-of-message flag of atpFlags will 
  4540. be set if the EOM bit is set in the last packet received in a valid response
  4541. sequence.  
  4542. The exactly-once flag should be set if you want the request to be part of an 
  4543. exactly-once transaction.
  4544.  
  4545. To cancel a SendRequest call, you need the transaction ID; it's returned in reqTID.  
  4546. You can examine reqTID before the completion of the call, but its contents are valid 
  4547. only after the tidValid bit of atpFlags has been set.
  4548. SendRequest completes when either an entire response is received or the retry 
  4549. count is exceeded.
  4550.  
  4551. Note:  The value provided in retryCount will be modified during SendRequest 
  4552.        if any retries are made.  This field is used to monitor the number of retries; 
  4553.        for each retry, it's decremented by 1.
  4554.  
  4555. Result codes    
  4556.  
  4557.    noErr             No error
  4558.       reqFailed      Retry count exceeded
  4559.       tooManyReqs      Too many concurrent requests
  4560.       noDataArea        Too many outstanding ATP calls
  4561.       reqAborted        Request canceled by user
  4562.  
  4563. æKY PGetRequest
  4564. æFp AppleTalk.p
  4565. æT FUNCTION
  4566. æD FUNCTION PGetRequest(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4567. æDT myVariable := PGetRequest(thePBPtr,async);
  4568. æRI II-317,V-513
  4569. æC GetRequest function
  4570.  
  4571. Parameter block
  4572.  
  4573.     <-   18 userData       long word   ;user bytes
  4574.     ->   26 csCode         word        ;always getRequest
  4575.     ->   28 atpSocket      byte        ;socket number
  4576.     <-   29 atpFlags       byte        ;control information
  4577.     <-   30 addrBlock      long word   ;source of request
  4578.     <->  34 reqLength      word        ;request buffer size
  4579.     ->   36 reqPointer     pointer     ;pointer to request buffer
  4580.     <-   44 bitMap         byte        ;bit map
  4581.     <-   46 transID        word        ;transaction ID
  4582.  
  4583. GetRequest sets up the mechanism to receive a request sent by a SendRequest call.  
  4584. UserData returns the four user bytes from the request.  ATPSocket contains the 
  4585. socket number of the socket that should listen for a request.  The internet address 
  4586. of the socket from which the request was sent is returned in addrBlock.  ReqLength 
  4587. and reqPointer indicate the size (in bytes) and location of a buffer to store the 
  4588. incoming request.  The actual size of the request is returned in reqLength.  The 
  4589. transaction bit map and transaction ID will be returned in bitMap and transID.  The 
  4590. exactly-once flag in atpFlags will be set if the request is part of an exactly-once 
  4591. transaction.
  4592.  
  4593. GetRequest completes when a request is received.
  4594.  
  4595. Result codes    
  4596.  
  4597.    noErr      No error
  4598.    badATPSkt  Bad responding socket
  4599.  
  4600. æKY PSendResponse
  4601. æFp AppleTalk.p
  4602. æT FUNCTION
  4603. æD FUNCTION PSendResponse(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4604. æDT myVariable := PSendResponse(thePBPtr,async);
  4605. æRI II-317,V-513
  4606. æC SendResponse function
  4607.  
  4608. Parameter block
  4609.  
  4610.     <-  18  userData      long word     ;user bytes from TRel
  4611.     <-  22  reqTID        word          ;transaction ID used in request
  4612.     ->  26  csCode        word          ;always sendResponse
  4613.     ->  28  atpSocket     byte          ;socket number
  4614.     ->  29  atpFlags      byte          ;control information
  4615.     ->  30  addrBlock     long word     ;response destination
  4616.     ->  40  bdsPointer    pointer       ;pointer to response BDS 
  4617.     ->  44  numOfBuffs    byte          ;number of response packets being sent
  4618.     ->  45  bdsSize       byte          ;BDS size in elements
  4619.     ->  46  transID       word          ;transaction ID 
  4620.  
  4621. SendResponse sends a response to a socket.  If the response was part of an exactly-
  4622. once transaction, userData will contain the user bytes from the TRel packet.  
  4623. ATPSocket contains the socket number from which the response should be sent.  The 
  4624. end-of-message flag in atpFlags should be set if the response contains the final 
  4625. packet in a transaction composed of a group of packets and the number of responses 
  4626. is less than requested.  AddrBlock indicates the address of the socket to which the 
  4627. response should be sent.  BDSPointer points to a response BDS containing room for 
  4628. the maximum number of responses to be sent; bdsSize contains this maximum 
  4629. number.  NumOfBuffs contains the number of response packets to be sent in this 
  4630. call; you may wish to make AddResponse calls to complete the response.  TransID 
  4631. indicates the transaction ID of the associated request.
  4632.  
  4633. During exactly-once transactions, SendResponse doesn't complete until either a 
  4634. TRel packet is received from the socket that made the request, or the retry count is 
  4635. exceeded.
  4636.  
  4637. Result codes    
  4638.  
  4639.       noErr              No error
  4640.       badATPSkt          Bad responding socket
  4641.       noRelErr           No release received
  4642.       noDataArea         Too many outstanding ATP calls
  4643.       badBuffNum         Sequence number out of range
  4644.  
  4645. æKY PAddResponse
  4646. æFp AppleTalk.p
  4647. æT FUNCTION
  4648. æD FUNCTION PAddResponse(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4649. æDT myVariable := PAddResponse(thePBPtr,async);
  4650. æRI II-318,V-513
  4651. æC AddResponse function
  4652.  
  4653. Parameter block
  4654.  
  4655.     ->  18  userData        long word   ;user bytes
  4656.     ->  26  csCode          word        ;always addResponse
  4657.     ->  28  atpSocket       byte        ;socket number
  4658.     ->  29  atpFlags        byte        ;control information
  4659.     ->  30  addrBlock       long word   ;response destination
  4660.     ->  34  reqLength       word        ;response size
  4661.     ->  36  reqPointer      pointer     ;pointer to response
  4662.     ->  44  rspNum          byte        ;sequence number
  4663.     ->  46  transID         word        ;transaction ID
  4664.  
  4665. AddResponse sends an additional response packet to a socket that has already been 
  4666. sent the initial part of a response via SendResponse.  UserData contains the four 
  4667. user bytes.  ATPSocket contains the socket number from which the response should 
  4668. be sent.  The end-of-message flag in atpFlags should be set if this response packet 
  4669. is the final packet in a transaction composed of a group of packets and the number 
  4670. of responses is less than requested.  AddrBlock indicates the socket to which the 
  4671. response should be sent.  ReqLength and reqPointer contain the size (in bytes) and 
  4672. location of the response to send; rspNum indicates the sequence number of the 
  4673. response (in the range 0 to 7).  TransID must contain the transaction ID.
  4674.  
  4675. Warning:  If the transaction is part of an exactly-once transaction, the buffer 
  4676.           used in the AddResponse call must not be altered or released until the 
  4677.           corresponding SendResponse call has completed. 
  4678.  
  4679. Result codes    
  4680.  
  4681.       noErr           No error
  4682.       badATPSkt       Bad responding socket
  4683.       noSendResp      AddResponse issued before SendResponse
  4684.       badBuffNum      Sequence number out of range
  4685.       noDataArea      Too many outstanding ATP calls
  4686.  
  4687. æKY PRelTCB
  4688. æFp AppleTalk.p
  4689. æT FUNCTION
  4690. æD FUNCTION PRelTCB(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4691. æDT myVariable := PRelTCB(thePBPtr,async);
  4692. æRI II-319,V-513
  4693. æC RelTCB function
  4694.  
  4695. Parameter block
  4696.  
  4697.     ->  26  csCode        word          ;always relTCB
  4698.     ->  30  addrBlock     long word     ;destination of request
  4699.     ->  46  transID       word          ;transaction ID of request
  4700.  
  4701. RelTCB dequeues the specified SendRequest call and returns the result code 
  4702. reqAborted for the aborted call.  The transaction ID can be obtained from the reqTID 
  4703. field of the SendRequest queue entry; see the description of SendRequest for details.
  4704.  
  4705. Result codes    
  4706.  
  4707.    noErr            No error
  4708.    cbNotFound       ATP control block not found
  4709.    noDataArea       Too many outstanding ATP calls
  4710.  
  4711. æKY PRelRspCB
  4712. æFp AppleTalk.p
  4713. æT FUNCTION
  4714. æD FUNCTION PRelRspCB(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4715. æDT myVariable := PRelRspCB(thePBPtr,async);
  4716. æRI II-319,V-514
  4717. æC RelRspCB function
  4718.  
  4719. Parameter block
  4720.  
  4721.     ->  26  csCode        word        ;always relRspCB
  4722.     ->  28  atpSocket     byte        ;socket number that request was received on
  4723.     ->  30  addrBlock     long word   ;source of request
  4724.     ->  46  transID       word        ;transaction ID of request
  4725.  
  4726. In an exactly-once transaction, RelRspCB cancels the specified SendResponse, 
  4727. without waiting for the release timer to expire or a TRel packet to be received.  No 
  4728. error is returned for the SendResponse call.  Whan called to cancel a transaction 
  4729. that isn't using exactly-once service, RelRspCB returns cbNotFound.  The 
  4730. transaction ID can be obtained from the reqTID field of the SendResponse queue 
  4731. entry; see the description of SendResponse for details.
  4732.  
  4733. Result codes    
  4734.  
  4735.    noErr            No error
  4736.    cbNotFound       ATP control block not found
  4737.  
  4738. æKY PNSendRequest
  4739. æFp AppleTalk.p
  4740. æT FUNCTION
  4741. æD FUNCTION PNSendRequest(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4742. æDT myVariable := PNSendRequest(thePBPtr,async);
  4743. æRI V-516
  4744. æC  
  4745. »Sending an ATP Request Through a Specified Socket
  4746.  
  4747. ATP requests can now be sent through client-specified sockets.  ATP previously would
  4748. open a dynamic socket, send the request through it, and close the socket when the
  4749. request was completed.  The client can now choose to send a request through an already-opened
  4750. socket; this also allows more than one request to be sent per socket.   A new call,
  4751. PNSendRequest, has been added for this purpose.  The function of the old SendRequest
  4752. call itself remains unchanged.
  4753.  
  4754. FUNCTION PNSendRequest (thePBptr: ATPBPtr; async: BOOLEAN) : OSErr;
  4755.  
  4756. Parameter block
  4757.   -->    18    userData     longword  User bytes
  4758.   <--    22    reqTID       word      Transaction ID used in request
  4759.   -->    26    csCode       word      Always sendRequest
  4760.   <->    28    atpSocket    byte      Socket to send request on
  4761.                                        or current bitmap
  4762.   <->    29    atpFlags     byte      Control information
  4763.   -->    30    addrBlock    longword  Destination socket address
  4764.   -->    34    reqLength    word      Request size in bytes
  4765.   -->    36    reqPointer   pointer   Pointer to request data
  4766.   -->    40    bdsPointer   pointer   Pointer to response BDS
  4767.   -->    44    numOfBuffs   byte      Number of responses expected
  4768.   -->    45    timeOutVal   byte      Timeout interval
  4769.   <--    46    numOf Resps  byte      Number of responses received
  4770.   <->    47    retryCount   byte      Number of retries
  4771.   <--    48    intBuff      word      Used internally
  4772.  
  4773. The PNSendRequest call is functionally equivalent to the SendRequest call, however
  4774. PNSendRequest allows you to specify, in the atpSocket field, the socket through which
  4775. the request is to be sent.  This socket must have been previously opened through an
  4776. OpenATPSkt request (otherwise a badATPSkt error will be returned).  Note that PNSendRequest
  4777. requires two additional bytes of memory at the end of the parameter block, immediately
  4778. following the retryCount.  These bytes are for the internal use of the AppleTalk
  4779. Manager and should not be modified while the PNSendRequest call is active.
  4780.  
  4781. There is a machine-dependent limit as to the number of concurrent PNSendRequests that
  4782. can be active on a given socket.  If this limit is exceeded, the error tooManyReqs is
  4783. returned.
  4784.  
  4785. One additional difference between SendRequest and PNSendRequest is that a PNSendRequest
  4786. can only be aborted by a PKillSendReq call (see below), whereas a SendRequest can be
  4787. aborted by either a RelTCB or KillSendReq call.
  4788.  
  4789. Result Codes    noErr          No error
  4790.                 reqFailed      Retry count exceeded
  4791.                 tooManyReqs    Too many concurrent requests
  4792.                 noDataArea     Too many outstanding ATP calls
  4793.                 reqAborted     Request cancelled by user
  4794.  
  4795. æKY PKillSendReq
  4796. æFp AppleTalk.p
  4797. æT FUNCTION
  4798. æD FUNCTION PKillSendReq(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4799. æDT myVariable := PKillSendReq(thePBPtr,async);
  4800. æRI V-517
  4801. æC  
  4802. »Aborting ATP SendRequests
  4803.  
  4804. The  RelTCB call is still supported, but only for aborting SendRequests.  To abort
  4805. PNSendRequests, a new call, PKillSendReq, has been added.  This call will abort both
  4806. SendRequests and PNSendRequests.  PKillSendReq’s only argument is the queue element
  4807. pointer of the request to be aborted.  The queue element pointer is passed at the
  4808. offset of the PKillSendReq queue element specified by aKillQE1.
  4809.  
  4810. FUNCTION PKillSendReq (thePBptr: ATPPBPtr; async: BOOLEAN) : OSErr;
  4811.  
  4812. Parameter block
  4813.   -->    26    csCode    word     Always PKillSendReq
  4814.   -->    44    aKillQEl  pointer  Pointer to queue element
  4815.  
  4816. PKillSendReq is functionally equivalent to RelTCB, except that it takes different
  4817. arguments and will abort both SendRequests and PNSendRequests.  To abort one of these
  4818. calls, place a pointer to the queue element of the call to abort in aKillQEl and
  4819. issue the PKillSendReq call.
  4820.  
  4821. Result Codes    noErr          No error
  4822.                 cbNotFound     aKillQEl does not point to a SendReq
  4823.                                or NSendReq queue element
  4824.  
  4825. æKY PKillGetReq
  4826. æFp AppleTalk.p
  4827. æT FUNCTION
  4828. æD FUNCTION PKillGetReq(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4829. æDT myVariable := PKillGetReq(thePBPtr,async);
  4830. æRI V-518
  4831. æC  
  4832. »Aborting ATP GetRequests
  4833.  
  4834. ATP GetRequests can now be aborted through the PKillGetReq call.  This call looks and
  4835. works just like the PKillSendReq call, and is used to abort a specific GetRequest
  4836. call.  Previously it was necessary to close the socket  to abort all GetRequest calls
  4837. on the socket.
  4838.  
  4839. FUNCTION PKillGetReq (thePBptr: ATPPBPtr; async: BOOLEAN) : OSErr;
  4840.  
  4841. Parameter block
  4842.   -->    26    csCode    word     Always PKillGetReq
  4843.   -->    44    aKillQEl  pointer  Pointer to queue element
  4844.  
  4845. PKillGetReq will abort a specific outstanding GetRequest call (as opposed to closing
  4846. the socket, which aborts all outstanding GetRequests on that socket).  The call will
  4847. be completed with a reqAborted error.  To abort a GetRequest, place a pointer to the
  4848. queue element of the call to abort in aKillQEl and issue the PKillGetReq call.
  4849.  
  4850. Result Codes    noErr         No error
  4851.                 cbNotFound    aKillQEl does not point to a GetReq
  4852.                               queue element
  4853.  
  4854. æKY PKillAllGetReq
  4855. æFp AppleTalk.p
  4856. æT FUNCTION
  4857. æD FUNCTION PKillAllGetReq(thePBPtr: ATPPBPtr;async: BOOLEAN): OSErr;
  4858. æDT myVariable := PKillAllGetReq(thePBPtr,async);
  4859. æRI V-518
  4860. æC  
  4861. »Aborting ATP GetRequests
  4862.  
  4863. ATP GetRequests can now be aborted through the PKillGetReq call.  This call looks and
  4864. works just like the PKillSendReq call, and is used to abort a specific GetRequest
  4865. call.  Previously it was necessary to close the socket  to abort all GetRequest calls
  4866. on the socket.
  4867.  
  4868. FUNCTION PKillGetReq (thePBptr: ATPPBPtr; async: BOOLEAN) : OSErr;
  4869.  
  4870. Parameter block
  4871.   -->    26    csCode    word     Always PKillGetReq
  4872.   -->    44    aKillQEl  pointer  Pointer to queue element
  4873.  
  4874. PKillGetReq will abort a specific outstanding GetRequest call (as opposed to closing
  4875. the socket, which aborts all outstanding GetRequests on that socket).  The call will
  4876. be completed with a reqAborted error.  To abort a GetRequest, place a pointer to the
  4877. queue element of the call to abort in aKillQEl and issue the PKillGetReq call.
  4878.  
  4879. Result Codes    noErr         No error
  4880.                 cbNotFound    aKillQEl does not point to a GetReq
  4881.                               queue element
  4882.  
  4883. æKY BuildLAPwds
  4884. æFp AppleTalk.p
  4885. æT PROCEDURE
  4886. æD PROCEDURE BuildLAPwds(wdsPtr: Ptr;dataPtr: Ptr;destHost: INTEGER;prototype: INTEGER;
  4887.     frameLen: INTEGER);
  4888. æDT BuildLAPwds(wdsPtr,dataPtr,destHost,prototype,frameLen);
  4889. æRI V-514
  4890. æC 
  4891. This routine builds a single-frame write data structure LAP WDS for use with the
  4892. PWriteLAP call.  Given a buffer of length frameLen pointed to by dataPtr, it fills in
  4893. the WDS pointed to by wdsPtr and sets the destination node and protocol type as
  4894. indicated by destHost and protoType, respectively.  The WDS indicated must contain at
  4895. least two elements.
  4896.  
  4897. æKY BuildDDPwds
  4898. æFp AppleTalk.p
  4899. æT PROCEDURE
  4900. æD PROCEDURE BuildDDPwds(wdsPtr: Ptr;headerPtr: Ptr;dataPtr: Ptr;netAddr: AddrBlock;
  4901.     ddpType: INTEGER;dataLen: INTEGER);
  4902. æDT BuildDDPwds(wdsPtr,headerPtr,dataPtr,netAddr,ddpType,dataLen);
  4903. æRI V-514
  4904. æC 
  4905. This routine builds a single-frame write data structure  DDP WDS, for use with the
  4906. PWriteDDP call.  Given a header buffer of at least 17 bytes pointed to by headerPtr
  4907. and a data buffer of length dataLen pointed to by dataPtr, it fills in the WDS pointed
  4908. to by wdsPtr, and sets the destination address and protocol type as indicated by
  4909. destaddress and DDPtype, respectively.  The WDS indicated must contain at least 3
  4910. elements.
  4911.  
  4912. æKY NBPSetEntity
  4913. æFp AppleTalk.p
  4914. æT PROCEDURE
  4915. æD PROCEDURE NBPSetEntity(buffer: Ptr;nbpObject: Str32;nbpType: Str32;nbpZone: Str32);
  4916. æDT NBPSetEntity(buffer,nbpObject,nbpType,nbpZone);
  4917. æRI V-514
  4918. æC 
  4919. This routine builds an NBP entity structure, for use with the PLookupNBP and PConfirmName
  4920. calls.  Given a buffer of at least the size of the EntityName data structure (99
  4921. bytes) pointed to by buffer, this routine sets the indicated object, type, and zone
  4922. in that buffer.
  4923.  
  4924. æKY NBPSetNTE
  4925. æFp AppleTalk.p
  4926. æT PROCEDURE
  4927. æD PROCEDURE NBPSetNTE(ntePtr: Ptr;nbpObject: Str32;nbpType: Str32;nbpZone: Str32;
  4928.     socket: INTEGER);
  4929. æDT NBPSetNTE(ntePtr,nbpObject,nbpType,nbpZone,socket);
  4930. æRI V-515
  4931. æC 
  4932. This routine builds an NBP names table entry, for use with the PRegisterName call. 
  4933. Given a names table entry of at least the size of the EntityName data structure plus
  4934. nine bytes (108 bytes) pointed to by ntePtr, this routine sets the indicated object,
  4935. type, zone, and socket in that names table entry.
  4936.  
  4937. æKY GetBridgeAddress
  4938. æFp AppleTalk.p
  4939. æT FUNCTION
  4940. æD FUNCTION GetBridgeAddress: INTEGER;
  4941. æDT myVariable := GetBridgeAddress;
  4942. æRT 132
  4943. æRI V-515, N132-2
  4944. æC 
  4945. This routine returns the current address of a bridge in the low byte, or zero if
  4946. there is none.
  4947.  
  4948. æKY BuildBDS
  4949. æFp AppleTalk.p
  4950. æT FUNCTION
  4951. æD FUNCTION BuildBDS(buffPtr: Ptr;bdsPtr: Ptr;buffSize: INTEGER): INTEGER;
  4952. æDT myVariable := BuildBDS(buffPtr,bdsPtr,buffSize);
  4953. æRI V-515
  4954. æC 
  4955. This routine builds a BDS, for use with the ATP calls.  Given a data buffer of length
  4956. buffSize pointed to by buffPtr, it fills in the BDS pointed to by bdsPtr.  The buffer
  4957. will be broken up into pieces of maximum size (578 bytes).  The user bytes in the BDS
  4958. are not modified by this routine.  This routine is provided only as a convenience;
  4959. generally the caller will be able to build the BDS completely from Pascal without
  4960. it.
  4961.  
  4962. æKY MPPOpen
  4963. æFp AppleTalk.p
  4964. æT FUNCTION
  4965. æD FUNCTION MPPOpen: OSErr;
  4966. æDT myVariable := MPPOpen;
  4967. æMM
  4968. æRT 224
  4969. æRI II-275
  4970. æC 
  4971. MPPOpen first checks whether the .MPP driver has already been loaded; if it has,
  4972. MPPOpen does nothing and returns noErr. If MPP hasn’t been loaded, MPPOpen attempts
  4973. to load it into the system heap. If it succeeds, it then initializes the driver’s
  4974. variables and goes through the process of dynamically assigning a node ID to that
  4975. Macintosh. On a Macintosh 512K or XL, it also loads the .ATP driver and NBP code into
  4976. the system heap.
  4977.  
  4978. If serial port B isn’t configured for AppleTalk, or is already in use, the .MPP
  4979. driver isn’t loaded and an appropriate result code is returned.
  4980.  
  4981. Result codes    noErr        No error
  4982.                 portInUse    Port B is already in use
  4983.                 portNotCf    Port B not configured for AppleTalk
  4984.  
  4985. æKY MPPClose
  4986. æFp AppleTalk.p
  4987. æT FUNCTION
  4988. æD FUNCTION MPPClose: OSErr;
  4989. æDT myVariable := MPPClose;
  4990. æMM
  4991. æRI II-275
  4992. æC 
  4993. MPPClose removes the .MPP driver, and any data structures associated with it, from
  4994. memory. If the .ATP driver or NBP code were also installed, they’re removed as well.
  4995. MPPClose also returns the use of port B to the Serial Driver.
  4996.  
  4997. Warning:  Since other co-resident programs may be using AppleTalk, it’s
  4998.           strongly recommended that you never use this call. MPPClose will
  4999.           completely disable AppleTalk; the only way to restore AppleTalk
  5000.           is to call MPPOpen again.
  5001.  
  5002. æKY LAPOpenProtocol
  5003. æFp AppleTalk.p
  5004. æT FUNCTION
  5005. æD FUNCTION LAPOpenProtocol(theLAPType: ABByte;protoPtr: Ptr): OSErr;
  5006. æDT myVariable := LAPOpenProtocol(theLAPType,protoPtr);
  5007. æMM
  5008. æRI II-277
  5009. æC 
  5010.  
  5011. æKY LAPCloseProtocol
  5012. æFp AppleTalk.p
  5013. æT FUNCTION
  5014. æD FUNCTION LAPCloseProtocol(theLAPType: ABByte): OSErr;
  5015. æDT myVariable := LAPCloseProtocol(theLAPType);
  5016. æMM
  5017. æRI II-277
  5018. æC 
  5019. LAPCloseProtocol removes from the node’s protocol table the specified ALAP protocol
  5020. type, as well as its protocol handler.
  5021.  
  5022. Warning:  Don’t close ALAP protocol type values 1 or 2. If you close these
  5023.           protocol types, DDP will be disabled; once disabled, the only way
  5024.           to restore DDP is to restart the system, or to close and then
  5025.           reopen AppleTalk.
  5026.  
  5027. Result codes    noErr         No error
  5028.                 lapProtErr    Error detaching protocol type
  5029.  
  5030. æKY LAPWrite
  5031. æFp AppleTalk.p
  5032. æT FUNCTION
  5033. æD FUNCTION LAPWrite(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5034. æDT myVariable := LAPWrite(abRecord,async);
  5035. æMM
  5036. æRI II-277
  5037. æC 
  5038. ABusRecord
  5039.   <--    abOpcode                {always tLAPWrite}
  5040.   <--    abResult                {result code}
  5041.   -->    abUserReference         {for your use}
  5042.   -->    lapAddress.dstNodeID    {destination node ID}
  5043.   -->    lapAddress.lapProtType  {ALAP protocol type}
  5044.   -->    lapReqCount             {length of frame data}
  5045.   -->    lapDataPtr              {pointer to frame data}
  5046.  
  5047. LAPWrite sends a frame to another node. LAPReqCount and lapDataPtr specify the length
  5048. and location of the data to send. The lapAddress.lapProtType field indicates the ALAP
  5049. protocol type of the frame and the lapAddress.dstNodeID indicates the node ID of the
  5050. node to which the frame should be sent.
  5051.  
  5052. Note:  The first two bytes of an ALAP frame’s data must contain the length
  5053.        in bytes of that data, including the length bytes themselves.
  5054.  
  5055. Result codes    noErr            No error
  5056.                 excessCollsns    Unable to contact destination node;
  5057.                                  packet not sent
  5058.                 ddpLenErr        ALAP data length too big
  5059.                 lapProtErr       Invalid ALAP protocol type
  5060.  
  5061. æKY LAPRead
  5062. æFp AppleTalk.p
  5063. æT FUNCTION
  5064. æD FUNCTION LAPRead(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5065. æDT myVariable := LAPRead(abRecord,async);
  5066. æMM
  5067. æRI II-278
  5068. æC  
  5069. ABusRecord
  5070.   <--    abOpcode                {always tLAPRead}
  5071.   <--    abResult                {result code}
  5072.   -->    abUserReference         {for your use}
  5073.   <--    lapAddress.dstNodeID    {destination node ID}
  5074.   <--    lapAddress.srcNodeID    {source node ID}
  5075.   -->    lapAddress.lapProtType  {ALAP protocol type}
  5076.   -->    lapReqCount             {buffer size in bytes}
  5077.   <--    lapActCount             {number of frame data bytes actually received}
  5078.   -->    lapDataPtr              {pointer to buffer}
  5079.  
  5080. LAPRead receives a frame from another node. LAPReqCount and lapDataPtr specify the
  5081. size and location of the buffer that will receive the frame data. If the buffer isn’t
  5082. large enough to hold all of the incoming frame data, the extra bytes will be discarded
  5083. and buf2SmallErr will be returned. The number of bytes actually received is returned
  5084. in lapActCount. Only frames with ALAP protocol type equal to lapAddress.lapProtType
  5085. will be received. The node IDs of the frame’s source and destination nodes are returned
  5086. in lapAddress.srcNodeID and lapAddress.dstNodeID. You can determine whether the
  5087. packet was broadcast to you by examining the value of lapAddress.dstNodeID—if the
  5088. packet was broadcast it’s equal to 255, otherwise it’s equal to your node ID.
  5089.  
  5090. Note:  You should issue LAPRead calls only for ALAP protocol types that were
  5091.        opened (via LAPOpenProtocol) to use the default protocol handler.
  5092.  
  5093. Warning:  If you close a protocol type for which there are still LAPRead
  5094.           calls pending, the calls will be canceled but the memory occupied
  5095.           by their ABusRecords will not be released. For this reason, before
  5096.           closing a protocol type, call LAPRdCancel to cancel any pending
  5097.           LAPRead calls associated with that protocol type.
  5098.  
  5099. Result codes    noErr           No error
  5100.                 buf2SmallErr    Frame too large for buffer
  5101.                 readQErr        Invalid protocol type or protocol type not
  5102.                                 found in table
  5103.  
  5104. æKY LAPRdCancel
  5105. æFp AppleTalk.p
  5106. æT FUNCTION
  5107. æD FUNCTION LAPRdCancel(abRecord: ABRecHandle): OSErr;
  5108. æDT myVariable := LAPRdCancel(abRecord);
  5109. æMM
  5110. æRI II-279
  5111. æC 
  5112. Given the handle to the ABusRecord of a previously made LAPRead call, LAPRdCancel
  5113. dequeues the LAPRead call, provided that a packet satisfying the LAPRead has not
  5114. already arrived. LAPRdCancel returns noErr if the LAPRead call is successfully removed
  5115. from the queue. If LAPRdCancel returns recNotFnd, check the abResult field to verify
  5116. that the LAPRead has been completed and determine its outcome.
  5117.  
  5118. Result codes    noErr        No error
  5119.                 readQErr     Invalid protocol type or protocol type not
  5120.                              found in table
  5121.                 recNotFnd    ABRecord not found in queue
  5122.  
  5123. »Example
  5124.  
  5125. This example sends an ALAP packet synchronously and waits asynchronously for a response.
  5126. Assume that both nodes are using a known protocol type (in this case, 73) to receive
  5127. packets, and that the destination node has a node ID of 4.
  5128.  
  5129. VAR
  5130.   myABRecord: ABRecHandle;
  5131.   myBuffer: PACKED ARRAY [0..599] OF CHAR; {buffer for both send and receive}
  5132.   myLAPType: Byte;
  5133.   errCode, index, dataLen: INTEGER;
  5134.   someText: Str255;
  5135.   async: BOOLEAN;
  5136.  
  5137. BEGIN
  5138.   errCode := MPPOpen;
  5139.   IF errCode <> noErr THEN
  5140.     WRITELN('Error in opening AppleTalk')
  5141.     {Maybe serial port B isn't available for use by AppleTalk}
  5142.   ELSE
  5143.     BEGIN
  5144.     {Call Memory Manager to allocate ABusRecord}
  5145.     myABRecord := ABRecHandle(NewHandle(lapSize));
  5146.     myLAPType := 73;
  5147.    {Enter myLAPType into protocol handler table and install default handler to }
  5148.     { service frames of that ALAP type. No packets of that ALAP type will be }
  5149.     { received until we call LAPRead.}
  5150.     errCode := LAPOpenProtocol(myLAPType, NIL);
  5151.     IF errCode <> noErr THEN
  5152.       WRITELN('Error while opening the protocol type')
  5153.       {Have we opened too many protocol types? Remember that DDP uses two of }
  5154.       { them.}
  5155.     ELSE
  5156.       BEGIN
  5157.       {Prepare data to be sent}
  5158.       someText := 'This data will be in the ALAP data area';
  5159.       {The .MPP implementation requires that the first two bytes of the ALAP }
  5160.       { data field contain the length of the data, including the length bytes }
  5161.       { themselves.}
  5162.       dataLen := LENGTH(someText) + 2;
  5163.       buffer[0] := CHR(dataLen DIV 256); {high byte of data length}
  5164.       buffer[1] := CHR(dataLen MOD 256); {low byte of data length}
  5165.       FOR index := 1 TO dataLen - 2 DO {stuff buffer with packet data}
  5166.         buffer[index + 1] := someText[index];
  5167.       async := FALSE;
  5168.       WITH myABRecord^^ DO {fill parameters in the ABusRecord}
  5169.         BEGIN
  5170.         lapAddress.lapProtType := myLAPType;
  5171.         lapAddress.dstNodeID := 4;
  5172.         lapReqCount := dataLen;
  5173.         lapDataPtr := @buffer;
  5174.         END;
  5175.       {Send the frame}
  5176.       errCode := LAPWrite(myABRecord, async);
  5177.       {In the case of a sync call, errCode and the abResult field of }
  5178.       { the myABRecord will contain the same result code. We can also }
  5179.       { reuse myABRecord, since we know whether the call has completed.}
  5180.       IF errCode <> noErr THEN
  5181.         WRITELN('Error while writing out the packet')
  5182.         {Maybe the receiving node wasn't on-line}
  5183.       ELSE
  5184.         BEGIN
  5185.         {We have sent out the packet and are now waiting for a response. We }
  5186.         { issue an async LAPRead call so that we don't “hang” waiting for a }
  5187.         { response that may not come.}
  5188.         async := TRUE;
  5189.         WITH myABRecord^^ DO
  5190.           BEGIN
  5191.           lapAddress.lapProtType := myLAPType;
  5192.           {ALAP type we want to receive }
  5193.           lapReqCount := 600; {our buffer is maximum size}
  5194.           lapDataPtr := @buffer;
  5195.           END;
  5196.         errCode := LAPRead(myABRecord, async); {wait for a packet}
  5197.         IF errCode <> noErr THEN
  5198.           WRITELN('Error while trying to queue up a LAPRead')
  5199.           {Was the protocol handler installed correctly?}
  5200.         ELSE
  5201.           BEGIN
  5202.           {We can either sit here in a loop and poll the abResult }
  5203.           { field or just exit our code and use the event }
  5204.           { mechanism to flag us when the packet arrives.}
  5205.           CheckForMyEvent; {your procedure for checking for a network event}
  5206.           errCode := LAPCloseProtocol(myLAPType);
  5207.           IF errCode <> noErr THEN
  5208.             WRITELN('Error while closing the protocol type');
  5209.           END;
  5210.         END;
  5211.       END;
  5212.     END;
  5213. END.
  5214.  
  5215. æKY DDPOpenSocket
  5216. æFp AppleTalk.p
  5217. æT FUNCTION
  5218. æD FUNCTION DDPOpenSocket(VAR theSocket: Byte;sktListener: Ptr): OSErr;
  5219. æDT myVariable := DDPOpenSocket(theSocket,sktListener);
  5220. æMM
  5221. æRI II-282
  5222. æC 
  5223. DDPOpenSocket adds a socket and its socket listener to the socket table. If theSocket
  5224. is nonzero, it must be in the range 64 to 127, and it specifies the socket’s number;
  5225. if theSocket is 0, DDPOpenSocket dynamically assigns a socket number in the range 128
  5226. to 254, and returns it in theSocket. SktListener contains a pointer to the socket
  5227. listener; if it’s NIL, the default listener will be used.
  5228.  
  5229. If you’re using the default socket listener, you must then call DDPRead to receive a
  5230. datagram (in order to specify buffer space for the default socket listener). If,
  5231. however, you’ve written your own socket listener and sktListener points to it, your
  5232. listener will provide buffers for receiving datagrams and you shouldn’t use DDPRead
  5233. calls.
  5234.  
  5235. DDPOpenSocket will return ddpSktErr if you pass the number of an already opened
  5236. socket, if you pass a socket number greater than 127, or if the socket table is
  5237. full.
  5238.  
  5239. Note:  The range of static socket numbers 1 through 63 is reserved by Apple
  5240.        for internal use. Socket numbers 64 through 127 are available for
  5241.        unrestricted experimental use.
  5242.  
  5243. Result codes    noErr        No error
  5244.                 ddpSktErr    Socket error
  5245.  
  5246. æKY DDPCloseSocket
  5247. æFp AppleTalk.p
  5248. æT FUNCTION
  5249. æD FUNCTION DDPCloseSocket(theSocket: Byte): OSErr;
  5250. æDT myVariable := DDPCloseSocket(theSocket);
  5251. æMM
  5252. æRI II-282
  5253. æC 
  5254.  
  5255. æKY DDPRead
  5256. æFp AppleTalk.p
  5257. æT FUNCTION
  5258. æD FUNCTION DDPRead(abRecord: ABRecHandle;retCksumErrs: BOOLEAN;async: BOOLEAN): OSErr;
  5259. æDT myVariable := DDPRead(abRecord,retCksumErrs,async);
  5260. æMM
  5261. æRI II-283
  5262. æC 
  5263. ABusRecord
  5264.   <--    abOpcode         {always tDDPRead}
  5265.   <--    abResult         {result code}
  5266.   -->    abUserReference  {for your use}
  5267.   <--    ddpType          {DDP protocol type}
  5268.   -->    ddpSocket        {listening socket number}
  5269.   <--    ddpAddress       {source socket address}
  5270.   -->    ddpReqCount      {buffer size in bytes}
  5271.   <--    ddpActCount      {number of bytes actually received}
  5272.   -->    ddpDataPtr       {pointer to buffer}
  5273.   <--    ddpNodeID        {original destination node ID}
  5274.  
  5275. DDPRead receives a datagram from another socket. The size and location of the buffer
  5276. that will receive the data are specified by ddpReqCount and ddpDataPtr. If the buffer
  5277. isn’t large enough to hold all of the incoming frame data, the extra bytes will be
  5278. discarded and buf2SmallErr will be returned. The number of bytes actually received is
  5279. returned in ddpActCount. DDPSocket specifies the socket to receive the datagram (the
  5280. “listening” socket). The node to which the packet was sent is returned in ddpNodeID;
  5281. if the packet was broadcast ddpNodeID will contain 255. The address of the socket
  5282. that sent the packet is returned in ddpAddress. If retCksumErrs is FALSE, DDPRead
  5283. will discard any packets received with an invalid checksum and inform the caller of
  5284. the error. If retCksumErrs is TRUE, DDPRead will deliver all packets, whether or not
  5285. the checksum is valid; it will also notify the caller when there’s a checksum error.
  5286.  
  5287. Note:  The sender of the datagram must be in a different node from the
  5288.        receiver. You should issue DDPRead calls only for receiving datagrams
  5289.        for sockets opened with the default socket listener; see the
  5290.        description of DDPOpenSocket.
  5291.  
  5292. Note:  If the buffer provided isn’t large enough to hold all of the incoming
  5293.        frame data (buf2SmallErr), the checksum can’t be calculated; in this
  5294.        case, DDPRead will deliver packets even if retCksumErrs is FALSE.
  5295.  
  5296. Result codes    noErr           No error
  5297.                 buf2SmallErr    Datagram too large for buffer
  5298.                 cksumErr        Checksum error
  5299.                 ddpLenErr       Datagram length too big
  5300.                 ddpSktErr       Socket error
  5301.                 readQErr        Invalid socket or socket not found in table
  5302.  
  5303. æKY DDPWrite
  5304. æFp AppleTalk.p
  5305. æT FUNCTION
  5306. æD FUNCTION DDPWrite(abRecord: ABRecHandle;doChecksum: BOOLEAN;async: BOOLEAN): OSErr;
  5307. æDT myVariable := DDPWrite(abRecord,doChecksum,async);
  5308. æMM
  5309. æRI II-283
  5310. æC  
  5311. ABusRecord
  5312.   <--    abOpcode         {always tDDPWrite}
  5313.   <--    abResult         {result code}
  5314.   -->    abUserReference  {for your use}
  5315.   -->    ddpType          {DDP protocol type}
  5316.   -->    ddpSocket        {source socket number}
  5317.   -->    ddpAddress       {destination socket address}
  5318.   -->    ddpReqCount      {length of datagram data}
  5319.   -->    ddpDataPtr       {pointer to buffer}
  5320.  
  5321. DDPWrite sends a datagram to another socket. DDPReqCount and ddpDataPtr specify the
  5322. length and location of the data to send. The ddpType field indicates the DDP protocol
  5323. type of the frame, and ddpAddress is the complete internet address of the socket to
  5324. which the datagram should be sent. DDPSocket specifies the socket from which the
  5325. datagram should be sent. Datagrams sent over the internet to a node on an AppleTalk
  5326. network different from the sending node’s network have an optional software checksum
  5327. to detect errors that might occur inside the intermediate bridges. If doChecksum is
  5328. TRUE, DDPWrite will compute this checksum; if it’s FALSE, this software checksum
  5329. feature is ignored.
  5330.  
  5331. Note:  The destination socket can’t be in the same node as the program
  5332.        making the DDPWrite call.
  5333.  
  5334. Result codes    noErr          No error
  5335.                 ddpLenErr      Datagram length too big
  5336.                 ddpSktErr      Source socket not open
  5337.                 noBridgeErr    No bridge found
  5338.  
  5339. æKY DDPRdCancel
  5340. æFp AppleTalk.p
  5341. æT FUNCTION
  5342. æD FUNCTION DDPRdCancel(abRecord: ABRecHandle): OSErr;
  5343. æDT myVariable := DDPRdCancel(abRecord);
  5344. æMM
  5345. æRI II-284
  5346. æC 
  5347. Given the handle to the ABusRecord of a previously made DDPRead call, DDPRdCancel
  5348. dequeues the DDPRead call, provided that a packet satisfying the DDPRead hasn’t
  5349. already arrived. DDPRdCancel returns noErr if the DDPRead call is successfully removed
  5350. from the queue. If DDPRdCancel returns recNotFnd, check the abResult field of abRecord
  5351. to verify that the DDPRead has been completed and determine its outcome.
  5352.  
  5353. Result codes    noErr        No error
  5354.                 readQErr     Invalid socket or socket not found in table
  5355.                 recNotFnd    ABRecord not found in queue
  5356.  
  5357. »Example
  5358.  
  5359. This example sends a DDP packet synchronously and waits asynchronously for a response.
  5360. Assume that both nodes are using a known socket number (in this case, 30) to receive
  5361. packets. Normally, you would want to use NBP to look up your destination’s socket
  5362. address.
  5363.  
  5364. VAR
  5365.   myABRecord: ABRecHandle;
  5366.   myBuffer: PACKED ARRAY [0..599] OF CHAR; {buffer for both send and receive}
  5367.   mySocket: Byte;
  5368.   errCode, index, dataLen: INTEGER;
  5369.   someText: Str255;
  5370.   async, retCksumErrs, doChecksum: BOOLEAN;
  5371.  
  5372. BEGIN
  5373.   errCode := MPPOpen;
  5374.   IF errCode <> noErr THEN
  5375.     WRITELN('Error in opening AppleTalk')
  5376.     {Maybe serial port B isn't available for use by AppleTalk}
  5377.   ELSE
  5378.     BEGIN
  5379.       {Call Memory Manager to allocate ABusRecord}
  5380.       myABRecord := ABRecHandle(NewHandle(ddpSize));
  5381.       mySocket := 30;
  5382.   {Add mySocket to socket table and install default socket listener to service }
  5383. { datagrams addressed to that socket. No packets addressed to mySocket will be }
  5384.       { received until we call DDPRead. }
  5385.       errCode := DDPOpenSocket(mySocket, NIL);
  5386.       IF errCode <> noErr THEN
  5387.         WRITELN('Error while opening the socket')
  5388.       {Have we opened too many socket listeners? Remember that DDP uses two of }
  5389.         { them.}
  5390.       ELSE
  5391.         BEGIN
  5392.           {Prepare data to be sent}
  5393.           someText := 'This is a sample datagram';
  5394.           dataLen := LENGTH(someText);
  5395.           FOR index := 0 TO dataLen - 1 DO {stuff buffer with packet data}
  5396.             myBuffer[index] := someText[index + 1];
  5397.           async := FALSE;
  5398.           WITH myABRecord^^ DO {fill the parameters in the ABusRecord}
  5399.             BEGIN
  5400.               ddpType := 5;
  5401.               ddpAddress.aNet := 0; {send on “our” network}
  5402.               ddpAddress.aNode := 34;
  5403.               ddpAddress.aSocket := mySocket;
  5404.               ddpReqCount := dataLen;
  5405.               ddpDataPtr := @myBuffer;
  5406.             END;
  5407.           doChecksum := FALSE;
  5408.     {If packet contains a DDP long header, compute checksum and insert it into }
  5409.           { the header.}
  5410.           errCode := DDPWrite(myABRecord, doChecksum, async); {send packet}
  5411.      {In the case of a sync call, errCode and the abResult field of myABRecord }
  5412.    { will contain the same result code. We can also reuse myABRecord, since we }
  5413.           { know whether the call has completed.}
  5414.           IF errCode <> noErr THEN
  5415.             WRITELN('Error while writing out the packet')
  5416.             {Maybe the receiving node wasn't on-line}
  5417.           ELSE
  5418.             BEGIN
  5419.            {We have sent out the packet and are now waiting for a response. We }
  5420.            { issue an async DDPRead call so that we don't “hang” waiting for a }
  5421.           { response that may not come. To cancel the async read call, we must }
  5422.               { close the socket associated with the call or call DDPRdCancel.}
  5423.               async := TRUE;
  5424.               retCksumErrs := TRUE; {return packets even if }
  5425.                                     { they have a checksum error}
  5426.               WITH myABRecord^^ DO
  5427.                 BEGIN
  5428.                   ddpSocket := mySocket;
  5429.                   ddpReqCount := 600; {our reception buffer is max size}
  5430.                   ddpDataPtr := @myBuffer;
  5431.                 END;
  5432.               {Wait for a packet asynchronously}
  5433.               errCode := DDPRead(myABRecord, retCksumErrs, async);
  5434.               IF errCode <> noErr THEN
  5435.                 WRITELN('Error while trying to queue up a DDPRead')
  5436.                 {Was the socket listener installed correctly?}
  5437.               ELSE
  5438.                 BEGIN
  5439.                   {We can either sit here in a loop and poll the }
  5440.                   { abResult field or just exit our code and use the }
  5441.                   { event mechanism to flag us when the packet arrives.}
  5442.                   CheckForMyEvent; {your procedure for checking for a }
  5443.                                    { network event}
  5444.                   {If there were no errors, a packet is inside the array }
  5445.                   { mybuffer, the length is in ddpActCount, and the }
  5446.                   { address of the sending socket is in ddpAddress. }
  5447.                   { Process the packet received here and report any errors.}
  5448.                   errCode := DDPCloseSocket(mySocket); {we're done with it}
  5449.                   IF errCode <> noErr THEN
  5450.                     WRITELN('Error while closing the socket');
  5451.                 END;
  5452.             END;
  5453.         END;
  5454.     END;
  5455. END.
  5456.  
  5457. æKY ATPLoad
  5458. æFp AppleTalk.p
  5459. æT FUNCTION
  5460. æD FUNCTION ATPLoad: OSErr;
  5461. æDT myVariable := ATPLoad;
  5462. æMM
  5463. æRT 20, 224
  5464. æRI II-290, N20-2
  5465. æC 
  5466. •••Refer to Technical Note #224:•••
  5467.  
  5468. ATPLoad first verifies that the .MPP driver is loaded and running. If it isn’t,
  5469. ATPLoad verifies that port B is configured for AppleTalk and isn’t in use, and then
  5470. loads MPP into the system heap.
  5471.  
  5472. ATPLoad then loads the .ATP driver, unless it’s already in memory. On a Macintosh
  5473. 128K, ATPLoad reads the .ATP driver from the system resource file into the application
  5474. heap; on a Macintosh 512K or XL, ATP is read into the system heap.
  5475.  
  5476. Note:  On a Macintosh 512K or XL, ATPLoad and MPPOpen perform essentially
  5477.        the same function.
  5478.  
  5479. Result codes    noErr        No error
  5480.                 portInUse    Port B is already in use
  5481.                 portNotCf    Port B not configured for AppleTalk
  5482.  
  5483. æKY ATPUnload
  5484. æFp AppleTalk.p
  5485. æT FUNCTION
  5486. æD FUNCTION ATPUnload: OSErr;
  5487. æDT myVariable := ATPUnload;
  5488. æRI II-290
  5489. æC 
  5490. ATPUnload makes the .ATP driver purgeable; the space isn’t actually released by the
  5491. Memory Manager until necessary.
  5492.  
  5493. Note:  This call applies only to a Macintosh 128K; on a Macintosh 512K
  5494.        or Macintosh XL, ATPUnload has no effect.
  5495.  
  5496. Result codes    noErr    No error
  5497.  
  5498. æKY ATPOpenSocket
  5499. æFp AppleTalk.p
  5500. æT FUNCTION
  5501. æD FUNCTION ATPOpenSocket(addrRcvd: AddrBlock;VAR atpSocket: Byte): OSErr;
  5502. æDT myVariable := ATPOpenSocket(addrRcvd,atpSocket);
  5503. æMM
  5504. æRI II-290
  5505. æC 
  5506. ATPOpenSocket opens a socket for the purpose of receiving requests. ATPSocket contains
  5507. the socket number of the socket to open; if it’s 0, a number is dynamically assigned
  5508. and returned in atpSocket. AddrRcvd contains a filter of the sockets from which
  5509. requests will be accepted. A 0 in the network number, node ID, or socket number field
  5510. of the addrRcvd record acts as a “wild card”; for instance, a 0 in the socket number
  5511. field means that requests will be accepted from all sockets in the node(s) specified
  5512. by the network and node fields.
  5513.  
  5514. Result codes    noErr          No error
  5515.                 tooManySkts    Socket table full
  5516.                 noDataArea     Too many outstanding ATP calls
  5517.  
  5518. Note:  If you’re only going to send requests and receive responses to
  5519.        these requests, you don’t need to open an ATP socket. When you
  5520.        make the ATPSndRequest or ATPRequest call, ATP automatically
  5521.        opens a dynamically assigned socket for that purpose.
  5522.  
  5523. æKY ATPCloseSocket
  5524. æFp AppleTalk.p
  5525. æT FUNCTION
  5526. æD FUNCTION ATPCloseSocket(atpSocket: Byte): OSErr;
  5527. æDT myVariable := ATPCloseSocket(atpSocket);
  5528. æMM
  5529. æRI II-291
  5530. æC 
  5531. ATPCloseSocket closes the responding socket whose number is specified by atpSocket.
  5532. It releases the data structures associated with all pending, asynchronous calls
  5533. involving that socket; these pending calls are completed immediately and return the
  5534. result code sktClosed.
  5535.  
  5536. Result codes    noErr         No error
  5537.                 noDataArea    Too many outstanding ATP calls
  5538.  
  5539. æKY ATPSndRequest
  5540. æFp AppleTalk.p
  5541. æT FUNCTION
  5542. æD FUNCTION ATPSndRequest(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5543. æDT myVariable := ATPSndRequest(abRecord,async);
  5544. æMM
  5545. æRI II-291
  5546. æC 
  5547. ABusRecord
  5548.   <--    abOpcode         {always tATPSndRequest}
  5549.   <--    abResult         {result code}
  5550.   -->    abUserReference  {for your use}
  5551.   -->    atpAddress       {destination socket address}
  5552.   -->    atpReqCount      {request size in bytes}
  5553.   -->    atpDataPtr       {pointer to buffer}
  5554.   -->    atpRspBDSPtr     {pointer to response BDS}
  5555.   -->    atpUserData      {user bytes}
  5556.   -->    atpXO            {exactly-once flag}
  5557.   <--    atpEOM           {end-of-message flag}
  5558.   -->    atpTimeOut       {retry timeout interval in seconds}
  5559.   -->    atpRetries       {maximum number of retries}
  5560.   -->    atpNumBufs       {number of elements in response BDS}
  5561.   <--    atpNumRsp        {number of response packets actually received}
  5562.  
  5563. ATPSndRequest sends a request to another socket. ATPAddress is the internet address
  5564. of the socket to which the request should be sent. ATPDataPtr and atpReqCount specify
  5565. the location and size of a buffer that contains the request information to be sent.
  5566. ATPUserData contains the user bytes for the ATP header.
  5567.  
  5568. ATPSndRequest requires you to allocate a response BDS. ATPRspBDSPtr is a pointer to
  5569. the response BDS; atpNumBufs indicates the number of elements in the BDS (this is
  5570. also the maximum number of response datagrams that will be accepted). The number of
  5571. response datagrams actually received is returned in atpNumRsp; if a nonzero value is
  5572. returned, you can examine the response BDS to determine which packets of the transaction
  5573. were actually received. If the number returned is less than requested, one of the
  5574. following is true:
  5575.  
  5576.   •  Some of the packets have been lost and the retry count has been exceeded.
  5577.   •  ATPEOM is TRUE; this means that the response consisted of fewer packets
  5578.      than were expected, but that all packets sent were received (the last
  5579.      packet came with the atpEOM flag set).
  5580.  
  5581. ATPTimeOut indicates the length of time that ATPSndRequest should wait for a response
  5582. before retransmitting the request. ATPRetries indicates the maximum number of retries
  5583. ATPSndRequest should attempt. ATPXO should be TRUE if you want the request to be part
  5584. of an exactly-once transaction.
  5585.  
  5586. ATPSndRequest completes when either the transaction is completed or the retry count
  5587. is exceeded.
  5588.  
  5589. Result codes    noErr          No error
  5590.                 reqFailed      Retry count exceeded
  5591.                 tooManyReqs    Too many concurrent requests
  5592.                 noDataArea     Too many outstanding ATP calls
  5593.  
  5594. æKY ATPRequest
  5595. æFp AppleTalk.p
  5596. æT FUNCTION
  5597. æD FUNCTION ATPRequest(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5598. æDT myVariable := ATPRequest(abRecord,async);
  5599. æMM
  5600. æRI II-292
  5601. æC 
  5602. ABusRecord
  5603.   <--    abOpcode         {always tATPRequest}
  5604.   <--    abResult         {result code}
  5605.   -->    abUserReference  {for your use}
  5606.   -->    atpAddress       {destination socket address}
  5607.   -->    atpReqCount      {request size in bytes}
  5608.   -->    atpDataPtr       {pointer to buffer}
  5609.   <--    atpActCount      {number of bytes actually received}
  5610.   -->    atpUserData      {user bytes}
  5611.   -->    atpXO            {exactly-once flag}
  5612.   <--    atpEOM           {end-of-message flag}
  5613.   -->    atpTimeOut       {retry timeout interval in seconds}
  5614.   -->    atpRetries       {maximum number of retries}
  5615.   <--    atpRspUData      {user bytes received in transaction response}
  5616.   -->    atpRspBuf        {pointer to response message buffer}
  5617.   -->    atpRspSize       {size of response message buffer}
  5618.  
  5619. ATPRequest is functionally analogous to ATPSndRequest. It sends a request to another
  5620. socket, but doesn’t require the caller to set up and use the BDS data structure to
  5621. describe the response buffers. ATPAddress indicates the socket to which the request
  5622. should be sent. ATPDataPtr and atpReqCount specify the location and size of a buffer
  5623. that contains the request information to be sent. ATPUserData contains the user bytes
  5624. to be sent in the request’s ATP header. ATPTimeOut indicates the length of time that
  5625. ATPRequest should wait for a response before retransmitting the request. ATPRetries
  5626. indicates the maximum number of retries ATPRequest should attempt.
  5627.  
  5628. To use this call, you must have an area of contiguous buffer space that’s large
  5629. enough to receive all expected datagrams. The various datagrams will be assembled in
  5630. this buffer and returned to you as a complete message upon completion of the transaction.
  5631. The location and size of this buffer are passed in atpRspBuf and atpRspSize. Upon
  5632. completion of the call, the size of the received response message is returned in
  5633. atpActCount. The user bytes received in the ATP header of the first response packet
  5634. are returned in atpRspUData. ATPXO should be TRUE if you want the request to be part
  5635. of an exactly-once transaction.
  5636.  
  5637. Although you don’t provide a BDS, ATPRequest in fact creates one and calls the
  5638. .ATP driver (as in an ATPSndRequest call). For this reason, the abRecord fields
  5639. atpRspBDSPtr and atpNumBufs are used by ATPRequest; you should not expect these
  5640. fields to remain unaltered during or after the function’s execution.
  5641.  
  5642. For ATPRequest to receive and correctly deliver the response as a single message, the
  5643. responding end must, upon receiving the request (with an ATPGetRequest call), generate
  5644. the complete response as a message in a single buffer and then call ATPResponse.
  5645.  
  5646. Note:  The responding end could also use ATPSndRsp and ATPAddRsp provided
  5647.        that each response packet (except the last one) contains exactly 578
  5648.        ATP data bytes; the last packet in the response can contain less than
  5649.        578 ATP data bytes. Also, if this method is used, only the ATP user
  5650.        bytes of the first response packet will be delivered to the requester;
  5651.        any information in the user bytes of the remaining response packets
  5652.        will not be delivered.
  5653.  
  5654. ATPRequest completes when either the transaction is completed or the retry count is
  5655. exceeded.
  5656.  
  5657. Result codes    noErr          No error
  5658.                 reqFailed      Retry count exceeded
  5659.                 tooManyReqs    Too many concurrent requests
  5660.                 sktClosed      Socket closed by a cancel call
  5661.                 noDataArea     Too many outstanding ATP calls
  5662.  
  5663. æKY ATPReqCancel
  5664. æFp AppleTalk.p
  5665. æT FUNCTION
  5666. æD FUNCTION ATPReqCancel(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5667. æDT myVariable := ATPReqCancel(abRecord,async);
  5668. æMM
  5669. æRI II-293
  5670. æC 
  5671. Given the handle to the ABusRecord of a previously made ATPSndRequest or ATPRequest
  5672. call, ATPReqCancel dequeues the ATPSndRequest or ATPRequest call, provided that the
  5673. call hasn’t already completed. ATPReqCancel returns noErr if the ATPSndRequest or
  5674. ATPRequest call is successfully removed from the queue. If it returns cbNotFound,
  5675. check the abResult field of abRecord to verify that the ATPSndRequest or ATPRequest
  5676. call has completed and determine its outcome.
  5677.  
  5678. Result codes    noErr         No error
  5679.                 cbNotFound    ATP control block not found
  5680.  
  5681. æKY ATPGetRequest
  5682. æFp AppleTalk.p
  5683. æT FUNCTION
  5684. æD FUNCTION ATPGetRequest(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5685. æDT myVariable := ATPGetRequest(abRecord,async);
  5686. æMM
  5687. æRT 20
  5688. æRI II-293, N20-2
  5689. æC  
  5690. ABusRecord
  5691.   <--    abOpcode         {always tATPGetRequest}
  5692.   <--    abResult         {result code}
  5693.   -->    abUserReference  {for your use}
  5694.   -->    atpSocket        {listening socket number}
  5695.   <--    atpAddress       {source socket address}
  5696.   -->    atpReqCount      {buffer size in bytes}
  5697.   -->    atpDataPtr       {pointer to buffer}
  5698.   <--    atpBitMap        {transaction bit map}
  5699.   <--    atpTransID       {transaction ID}
  5700.   <--    atpActCount      {number of bytes actually received}
  5701.   <--    atpUserData      {user bytes}
  5702.   <--    atpXO            {exactly-once flag}
  5703.  
  5704. ATPGetRequest sets up the mechanism to receive a request sent by either an ATPSndRequest
  5705. or an ATPRequest call. ATPSocket contains the socket number of the socket that should
  5706. listen for a request; this socket must already have been opened by calling ATPOpenSocket.
  5707. The address of the socket from which the request was sent is returned in atpAddress.
  5708. ATPDataPtr specifies a buffer to store the incoming request; atpReqCount indicates
  5709. the size of the buffer in bytes. The number of bytes actually received in the request
  5710. is returned in atpActCount. ATPUserData contains the user bytes from the ATP header.
  5711. The transaction bit map is returned in atpBitMap. The transaction ID is returned in
  5712. atpTransID. ATPXO will be TRUE if the request is part of an exactly-once transaction.
  5713.  
  5714. ATPGetRequest completes when a request is received. To cancel an asynchronous ATPGetRequest
  5715. call, you must call ATPCloseSocket, but this cancels all pending calls involving that
  5716. socket.
  5717.  
  5718. Result codes    noErr        No error
  5719.                 badATPSkt    Bad responding socket
  5720.                 sktClosed    Socket closed by a cancel call
  5721.  
  5722. æKY ATPSndRsp
  5723. æFp AppleTalk.p
  5724. æT FUNCTION
  5725. æD FUNCTION ATPSndRsp(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5726. æDT myVariable := ATPSndRsp(abRecord,async);
  5727. æMM
  5728. æRI II-294
  5729. æC  
  5730. ABusRecord
  5731.   <--    abOpcode         {always tATPSdRsp}
  5732.   <--    abResult         {result code}
  5733.   -->    abUserReference  {for your use}
  5734.   -->    atpSocket        {responding socket number}
  5735.   -->    atpAddress       {destination socket address}
  5736.   -->    atpRspBDSPtr     {pointer to response BDS}
  5737.   -->    atpTransID       {transaction ID}
  5738.   -->    atpEOM           {end-of-message flag}
  5739.   -->    atpNumBufs       {number of response packets being sent}
  5740.   -->    atpBDSSize       {number of elements in response BDS}
  5741.  
  5742. ATPSndRsp sends a response to another socket. ATPSocket contains the socket number
  5743. from which the response should be sent and atpAddress contains the internet address
  5744. of the socket to which the response should be sent. ATPTransID must contain the
  5745. transaction ID. ATPEOM is TRUE if the response BDS contains the final packet in a
  5746. transaction composed of a group of packets and the number of packets in the response
  5747. is less than expected. ATPRspBDSPtr points to the buffer data structure containing
  5748. the responses to be sent. ATPBDSSize indicates the number of elements in the response
  5749. BDS, and must be in the range 1 to 8. ATPNumBufs indicates the number of response
  5750. packets being sent with this call, and must be in the range 0 to 8.
  5751.  
  5752. Note:  In some situations, you may want to send only part (or possibly none)
  5753.        of your response message back immediately. For instance, you might be
  5754.        requested to send back seven disk blocks, but have only enough internal
  5755.        memory to store one block. In this case, set atpBDSSize to 7 (total
  5756.        number of response packets), atpNumBufs to 0 (number of response
  5757.        packets currently being sent), and call ATPSndRsp. Then as you read
  5758.        in one block at a time, call ATPAddRsp until all seven response
  5759.        datagrams have been sent.
  5760.  
  5761. During exactly-once transactions, ATPSndRsp won’t complete until the release packet
  5762. is received or the release timer expires.
  5763.  
  5764. Result codes    noErr         No error
  5765.                 badATPSkt     Bad responding socket
  5766.                 noRelErr      No release received
  5767.                 sktClosed     Socket closed by a cancel call
  5768.                 noDataArea    Too many outstanding ATP calls
  5769.                 badBuffNum    Bad sequence number
  5770.  
  5771. æKY ATPAddRsp
  5772. æFp AppleTalk.p
  5773. æT FUNCTION
  5774. æD FUNCTION ATPAddRsp(abRecord: ABRecHandle): OSErr;
  5775. æDT myVariable := ATPAddRsp(abRecord);
  5776. æMM
  5777. æRI II-295
  5778. æC  
  5779. ABusRecord
  5780.   <--    abOpcode         {always tATPAddRsp}
  5781.   <--    abResult         {result code}
  5782.   -->    abUserReference  {for your use}
  5783.   -->    atpSocket        {responding socket number}
  5784.   -->    atpAddress       {destination socket address}
  5785.   -->    atpReqCount      {buffer size in bytes}
  5786.   -->    atpDataPtr       {pointer to buffer}
  5787.   -->    atpTransID       {transaction ID}
  5788.   -->    atpUserData      {user bytes}
  5789.   -->    atpEOM           {end-of-message flag}
  5790.   -->    atpNumRsp        {sequence number}
  5791.  
  5792. ATPAddRsp sends one additional response packet to a socket that has already been sent
  5793. the initial part of a response via ATPSndRsp. ATPSocket contains the socket number
  5794. from which the response should be sent and atpAddress contains the internet address
  5795. of the socket to which the response should be sent. ATPTransID must contain the
  5796. transaction ID. ATPDataPtr and atpReqCount specify the location and size of a buffer
  5797. that contains the information to send; atpNumRsp is the sequence number of the response.
  5798. ATPEOM is TRUE if this response datagram is the final packet in a transaction composed
  5799. of a group of packets. ATPUserData contains the user bytes to be sent in this response
  5800. datagram’s ATP header.
  5801.  
  5802. Note:  No BDS is needed with ATPAddRsp because all pertinent information
  5803.        is passed within the record.
  5804.  
  5805. Result codes    noErr         No error
  5806.                 badATPSkt     Bad responding socket
  5807.                 badBuffNum    Bad sequence number
  5808.                 noSendResp    ATPAddRsp issued before ATPSndRsp
  5809.                 noDataArea    Too many outstanding ATP calls
  5810.  
  5811. æKY ATPResponse
  5812. æFp AppleTalk.p
  5813. æT FUNCTION
  5814. æD FUNCTION ATPResponse(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5815. æDT myVariable := ATPResponse(abRecord,async);
  5816. æMM
  5817. æRT 20
  5818. æRI II-296, N20-2
  5819. æC 
  5820. ABusRecord
  5821.   <--    abOpcode         {always tATPResponse}
  5822.   <--    abResult         {result code}
  5823.   -->    abUserReference  {for your use}
  5824.   -->    atpSocket        {responding socket number}
  5825.   -->    atpAddress       {destination socket address}
  5826.   -->    atpTransID       {transaction ID)
  5827.   -->    atpRspUData      {user bytes sent in transaction response}
  5828.   -->    atpRspBuf        {pointer to response message buffer}
  5829.   -->    atpRspSize       {size of response message buffer}
  5830.  
  5831. ATPResponse is functionally analogous to ATPSndRsp. It sends a response to another
  5832. socket, but doesn’t require the caller to provide a BDS. ATPAddress must contain the
  5833. complete network address of the socket to which the response should be sent (taken
  5834. from the data provided by an ATPGetRequest call). ATPTransID must contain the transaction
  5835. ID. ATPSocket indicates the socket from which the response should be sent (the socket
  5836. on which the corresponding ATPGetRequest was issued). ATPRspBuf points to the buffer
  5837. containing the response message; the size of this buffer must be passed in atpRspSize.
  5838. The four user bytes to be sent in the ATP header of the first response packet are
  5839. passed in atpRspUData. The last packet of the transaction response is sent with the
  5840. EOM flag set.
  5841.  
  5842. Although you don’t provide a BDS, ATPResponse in fact creates one and calls the .ATP
  5843. driver (as in an ATPSndRsp call). For this reason, the abRecord fields atpRspBDSPtr
  5844. and atpNumBufs are used by ATPResponse; you should not expect these fields to remain
  5845. unaltered during or after the function’s execution.
  5846.  
  5847. During exactly-once transactions ATPResponse won’t complete until the release packet
  5848. is received or the release timer expires.
  5849.  
  5850. Warning:  The maximum permissible size of the response message is 4624 bytes.
  5851.  
  5852. Result codes    noErr         No error
  5853.                 badATPSkt     Bad responding socket
  5854.                 noRelErr      No release received
  5855.                 atpLenErr     Response too big
  5856.                 sktClosed     Socket closed by a cancel call
  5857.                 noDataArea    Too many outstanding ATP calls
  5858.  
  5859. æKY ATPRspCancel
  5860. æFp AppleTalk.p
  5861. æT FUNCTION
  5862. æD FUNCTION ATPRspCancel(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5863. æDT myVariable := ATPRspCancel(abRecord,async);
  5864. æMM
  5865. æRI II-296
  5866. æC 
  5867. Given the handle to the ABusRecord of a previously made ATPSndRsp or ATPResponse
  5868. call, ATPRspCancel dequeues the ATPSndRsp or ATPResponse call, provided that the call
  5869. hasn’t already completed. ATPRspCancel returns noErr if the ATPSndRsp or ATPResponse
  5870. call is successfully removed from the queue. If it returns cbNotFound, check the
  5871. abResult field of abRecord to verify that the ATPSndRsp or ATPResponse call has
  5872. completed and determine its outcome.
  5873.  
  5874. Result codes    noErr         No error
  5875.                 cbNotFound    ATP control block not found
  5876.  
  5877. »Example
  5878.  
  5879. This example shows the requesting side of an ATP transaction that asks for a 512-byte
  5880. disk block from the responding end. The block number of the file is a byte and is
  5881. contained in myBuffer[0].
  5882.  
  5883. VAR
  5884.   myABRecord: ABRecHandle;
  5885.   myBDSPtr: BDSPtr;
  5886.   myBuffer: PACKED ARRAY [0..511] OF CHAR;
  5887.   errCode: INTEGER;
  5888.   async: BOOLEAN;
  5889.  
  5890. BEGIN
  5891.   errCode := ATPLoad;
  5892.   IF errCode <> noErr THEN
  5893.     WRITELN('Error in opening AppleTalk')
  5894.     {Maybe serial port B isn't available for use by AppleTalk}
  5895.   ELSE
  5896.     BEGIN
  5897.       {Prepare the BDS; allocate space for a one-element BDS}
  5898.       myBDSPtr := BDSPtr(NewPtr(SIZEOF(BDSElement)));
  5899.       WITH myBDSPtr^[0] DO
  5900.         BEGIN
  5901.           buffSize := 512; {size of our buffer used in reception}
  5902.           buffPtr := @myBuffer; {pointer to the buffer}
  5903.         END;
  5904.       {Prepare the ABusRecord}
  5905.       myBuffer[0] := CHR(1); {requesting disk block number 1}
  5906.       myABRecord := ABRecHandle(NewHandle(atpSize));
  5907.       WITH myABRecord^^ DO
  5908.         BEGIN
  5909.           atpAddress.aNet := 0;
  5910.           atpAddress.aNode := 30; {we probably got this from an NBP call}
  5911.           atpAddress.aSocket := 15; {socket to send request to}
  5912.           atpReqCount := 1; {size of request data field (disk block #)}
  5913.           atpDataPtr := @myBuffer; {ptr to request to be sent}
  5914.           atpRspBDSPtr := @myBDSPtr;
  5915.           atpUserData := 0; {for your use}
  5916.           atpXO := FALSE; {at-least-once service}
  5917.           atpTimeOut := 5; {5-second timeout}
  5918.           atpRetries := 3; {3 retries; request will be sent 4 times max}
  5919.           atpNumBufs := 1; {we're only expecting 1 block to be returned}
  5920.         END;
  5921.       async := FALSE;
  5922.       {Send the request and wait for the response}
  5923.       errCode := ATPSndRequest(myABRecord, async);
  5924.       IF errCode <> noErr THEN
  5925.         WRITELN('An error occurred in the ATPSndRequest call')
  5926.       ELSE
  5927.         BEGIN
  5928.           {The disk block requested is now in myBuffer. We can verify }
  5929.           { that atpNumRsp contains 1, meaning one response received.}
  5930.         . . .
  5931.         END;
  5932.     END;
  5933. END.
  5934.  
  5935. æKY NBPRegister
  5936. æFp AppleTalk.p
  5937. æT FUNCTION
  5938. æD FUNCTION NBPRegister(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5939. æDT myVariable := NBPRegister(abRecord,async);
  5940. æMM
  5941. æRT 20
  5942. æRI II-299, N20-2
  5943. æC 
  5944. ABusRecord
  5945.   <--    abOpcode            {always tNBPRegister}
  5946.   <--    abResult            {result code}
  5947.   -->    abUserReference     {for your use}
  5948.   -->    nbpEntityPtr        {pointer to entity name}
  5949.   -->    nbpBufPtr           {pointer to buffer}
  5950.   -->    nbpBufSize          {buffer size in bytes}
  5951.   -->    nbpAddress.aSocket  {socket address}
  5952.   -->    nbpRetransmitInfo   {retransmission information}
  5953.  
  5954. NBPRegister adds the name and address of an entity to the node’s names table. NBPEntityPtr
  5955. points to a variable of type EntityName containing the entity’s name. If the name is
  5956. already registered, NBPRegister returns the result code nbpDuplicate. NBPAddress
  5957. indicates the socket for which the name should be registered. NBPBufPtr and nbpBufSize
  5958. specify the location and size of a buffer for NBP to use internally.
  5959.  
  5960. While the variable of type EntityName is declared as three 32-byte strings, only the
  5961. actual characters of the name are placed in the buffer pointed to by nbpBufPtr. For
  5962. this reason, nbpBufSize needs only to be equal to the actual length of the name, plus
  5963. an additional 12 bytes for use by NBP.
  5964.  
  5965. Warning:  This buffer must not be altered or released until the name is
  5966.           removed from the names table via an NBPRemove call. If you
  5967.           allocate the buffer through a NewHandle call, you must lock
  5968.           it as long as the name is registered.
  5969.  
  5970. Warning:  The zone field of the entity name must be set to the
  5971.           meta-character “*”.
  5972.  
  5973. Result codes    noErr           No error
  5974.                 nbpDuplicate    Duplicate name already exists
  5975.  
  5976. æKY NBPLookup
  5977. æFp AppleTalk.p
  5978. æT FUNCTION
  5979. æD FUNCTION NBPLookup(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  5980. æDT myVariable := NBPLookup(abRecord,async);
  5981. æMM
  5982. æRT 9, 20
  5983. æRI II-300, N9-1, 2, N20-2 
  5984. æC 
  5985. ABusRecord
  5986.   <--    abOpcode           {always tNBPLookup}
  5987.   <--    abResult           {result code}
  5988.   -->    abUserReference    {for your use}
  5989.   -->    nbpEntityPtr       {pointer to entity name}
  5990.   -->    nbpBufPtr          {pointer to buffer}
  5991.   -->    nbpBufSize         {buffer size in bytes}
  5992.   <->    nbpDataField       {number of addresses received}
  5993.   -->    nbpRetransmitInfo  {retransmission information}
  5994.  
  5995. NBPLookup returns the addresses of all entities with a specified name. NBPEntityPtr
  5996. points to a variable of type EntityName containing the name of the entity whose
  5997. address should be returned. (Meta-characters are allowed in the entity name.) NBPBufPtr
  5998. and nbpBufSize contain the location and size of an area of memory in which the entity
  5999. names and their corresponding addresses should be returned. NBPDataField indicates
  6000. the maximum number of matching names to find addresses for; the actual number of
  6001. addresses found is returned in nbpDataField. NBPRetransmitInfo contains the retry
  6002. interval and the retry count.
  6003.  
  6004. When specifying nbpBufSize, for each NBP tuple expected, allow space for the actual
  6005. characters of the name, the address, and four bytes for use by NBP.
  6006.  
  6007. Result codes    noErr         No error
  6008.                 nbpBuffOvr    Buffer overflow
  6009.  
  6010. æKY NBPExtract
  6011. æFp AppleTalk.p
  6012. æT FUNCTION
  6013. æD FUNCTION NBPExtract(theBuffer: Ptr;numInBuf: INTEGER;whichOne: INTEGER;
  6014.     VAR abEntity: EntityName;VAR address: AddrBlock): OSErr;
  6015. æDT myVariable := NBPExtract(theBuffer,numInBuf,whichOne,abEntity,address);
  6016. æMM
  6017. æRI II-300,V-515
  6018. æC 
  6019. This routine is provided in the alternate interface, but can be used as provided for
  6020. extracting NBP entity names from a look-up response buffer.
  6021.  
  6022. NBPExtract returns one address from the list of addresses returned by NBPLookup.
  6023. TheBuffer and numInBuf indicate the location and number of tuples in the buffer.
  6024. WhichOne specifies which one of the tuples in the buffer should be returned in the
  6025. abEntity and address parameters.
  6026.  
  6027. Result codes    noErr         No error
  6028.                 extractErr    Can’t find tuple in buffer
  6029.  
  6030. æKY NBPConfirm
  6031. æFp AppleTalk.p
  6032. æT FUNCTION
  6033. æD FUNCTION NBPConfirm(abRecord: ABRecHandle;async: BOOLEAN): OSErr;
  6034. æDT myVariable := NBPConfirm(abRecord,async);
  6035. æMM
  6036. æRT 9
  6037. æRI II-301, N9-2
  6038. æC 
  6039. ABusRecord
  6040.   <--    abOpcode           {always tNBPConfirm}
  6041.   <--    abResult           {result code}
  6042.   -->    abUserReference    {for your use}
  6043.   -->    nbpEntityPtr       {pointer to entity name}
  6044.   <--    nbpDataField       {socket number}
  6045.   -->    nbpAddress         {socket address}
  6046.   -->    nbpRetransmitInfo  {retransmission information}
  6047.  
  6048. NBPConfirm confirms that an entity known by name and address still exists (is still
  6049. entered in the names directory). NBPEntityPtr points to a variable of type EntityName
  6050. that contains the name to confirm, and nbpAddress specifies the address to be confirmed.
  6051. (No meta-characters are allowed in the entity name.) NBPRetransmitInfo contains the
  6052. retry interval and the retry count. The socket number of the entity is returned in
  6053. nbpDataField. NBPConfirm is more efficient than NBPLookup in terms of network traffic.
  6054.  
  6055. Result codes    noErr           No error
  6056.                 nbpConfDiff     Name confirmed for different socket
  6057.                 nbpNoConfirm    Name not confirmed
  6058.  
  6059. æKY NBPRemove
  6060. æFp AppleTalk.p
  6061. æT FUNCTION
  6062. æD FUNCTION NBPRemove(abEntity: EntityPtr): OSErr;
  6063. æDT myVariable := NBPRemove(abEntity);
  6064. æMM
  6065. æRI II-301
  6066. æC 
  6067. NBPRemove removes an entity name from the names table of the given entity’s node.
  6068.  
  6069. Result codes    noErr          No error
  6070.                 nbpNotFound    Name not found
  6071.  
  6072. æKY NBPLoad
  6073. æFp AppleTalk.p
  6074. æT FUNCTION
  6075. æD FUNCTION NBPLoad: OSErr;
  6076. æDT myVariable := NBPLoad;
  6077. æMM
  6078. æRI II-301
  6079. æC 
  6080. On a Macintosh 128K, NBPLoad reads the NBP code from the system resource file into
  6081. the application heap. On a Macintosh 512K or XL, NBPLoad has no effect since the NBP
  6082. code should have already been loaded when the .MPP driver was opened. Normally you’ll
  6083. never need to call NBPLoad, because the AppleTalk Manager calls it when necessary.
  6084.  
  6085. Result codes    noErr    No error
  6086.  
  6087. æKY NBPUnload
  6088. æFp AppleTalk.p
  6089. æT FUNCTION
  6090. æD FUNCTION NBPUnload: OSErr;
  6091. æDT myVariable := NBPUnload;
  6092. æMM
  6093. æRI II-301
  6094. æC 
  6095. On a Macintosh 128K, NBPUnload makes the NBP code purgeable; the space isn’t actually
  6096. released by the Memory Manager until necessary. On a Macintosh 512K or Macintosh XL,
  6097. NBPUnload has no effect.
  6098.  
  6099. Result codes    noErr    No error
  6100.  
  6101. »Example
  6102.  
  6103. This example of NBP registers our node as a print spooler, searches for any print
  6104. spoolers registered on the network, and then extracts the information for the first
  6105. one found.
  6106.  
  6107. CONST
  6108.   mySocket = 20;
  6109.  
  6110. VAR
  6111.   myABRecord: ABRecHandle;
  6112.   myEntity: EntityName;
  6113.   entityAddr: AddrBlock;
  6114.   nbpNamePtr: Ptr;
  6115.   myBuffer: PACKED ARRAY [0..999] OF CHAR;
  6116.   errCode: INTEGER;
  6117.   async: BOOLEAN;
  6118.  
  6119. BEGIN
  6120.   errCode := MPPOpen;
  6121.   IF errCode <> noErr THEN
  6122.     WRITELN('Error in opening AppleTalk')
  6123.     {Maybe serial port B isn't available for use by AppleTalk}
  6124.   ELSE
  6125.     BEGIN
  6126.       {Call Memory Manager to allocate ABusRecord}
  6127.       myABRecord := ABRecHandle(NewHandle(nbpSize));
  6128.       {Set up our entity name to register}
  6129.       WITH myEntity DO
  6130.         BEGIN
  6131.           objStr := 'Gene Station'; {we are called 'Gene Station' }
  6132.           typeStr := 'PrintSpooler'; { and are of type 'PrintSpooler'}
  6133.           zoneStr := '*';
  6134.           {Allocate data space for the entity name (used by NBP)}
  6135.           nbpNamePtr := NewPtr(LENGTH(objStr) + LENGTH(typeStr) +
  6136.                                LENGTH(zoneStr) + 12);
  6137.         END;
  6138.       {Set up the ABusRecord for the NBPRegister call}
  6139.       WITH myABRecord^^ DO
  6140.         BEGIN
  6141.           nbpEntityPtr := @myEntity;
  6142.           nbpBufPtr := nbpNamePtr; {buffer used by NBP internally}
  6143.           nbpBufSize := nbpNameBufSize;
  6144.           nbpAddress.aSocket := mySocket; {socket to register us on}
  6145.           nbpRetransmitInfo.retransInterval := 8; {retransmit every 64 }
  6146.           nbpRetransmitInfo.retransCount := 3; { ticks and try 3 times}
  6147.         END;
  6148.       async := FALSE;
  6149.       errCode := NBPRegister(myABRecord, async);
  6150.       IF errCode <> noErr THEN
  6151.         WRITELN('Error occurred in the NBPRegister call')
  6152.         {Maybe the name is already registered somewhere else on the }
  6153.         { network.}
  6154.       ELSE
  6155.         BEGIN
  6156.           {Now that we've registered our name, find others of type }
  6157.           { 'PrintSpooler'.}
  6158.           WITH myEntity DO
  6159.             BEGIN
  6160.               objStr := '='; {any one of type }
  6161.               typeStr := 'PrintSpooler'; { “PrintSpooler” }
  6162.               zoneStr := '*'; { in our zone}
  6163.             END;
  6164.           WITH myABRecord^^ DO
  6165.             BEGIN
  6166.               nbpEntityPtr := @myEntity;
  6167.               nbpBufPtr := @myBuffer; {buffer to place responses in}
  6168.               nbpBufSize := SIZEOF(myBuffer);
  6169.              {The field nbpDataField, before the NBPLookup call, represents an }
  6170.               { approximate number of responses. After the call, nbpDataField }
  6171.               { contains the actual number of responses received.}
  6172.               nbpDataField := 100; {we want about 100 responses back}
  6173.             END;
  6174.           errCode := NBPLookup(myABRecord, async); {make sync call}
  6175.           IF errCode <> noErr THEN
  6176.             WRITELN('An error occurred in the NBPLookup')
  6177.             {Did the buffer overflow?}
  6178.           ELSE
  6179.             BEGIN
  6180.               {Get the first reply}
  6181.               errCode := NBPExtract(@mybuffer, myABRecord^^.nbpDataField, 1,
  6182.                                     myEntity, entityAddr);
  6183.            {The socket address and name of the entity are returned here. If we }
  6184.              { want all of them, we'll have to loop for each one in the buffer.}
  6185.               IF errCode <> noErr THEN WRITELN('Error in NBPExtract');
  6186.               {Maybe the one we wanted wasn't in the buffer}
  6187.             END;
  6188.         END;
  6189.     END;
  6190. END.
  6191.  
  6192. æKY RemoveHdlBlocks
  6193. æFp AppleTalk.p
  6194. æT PROCEDURE
  6195. æD PROCEDURE RemoveHdlBlocks;
  6196. { RemoveHdlBlks is a routine that is called automatically at the beginning of
  6197.  every pascal call.  It checks for free (disposable) memory blocks that
  6198.  the interface has allocated, and disposes of them.  The memory blocks have
  6199.  been allocated by the NewHandle call.Most of these memory blocks are
  6200.  small (on the order of 20-50 bytes).  The user, at his option, may also
  6201.  make the call whenever s/he wants to.The general rule is that one memory
  6202.  block will be allocated every time a network call is made; and it will
  6203.  not be free until the call completes. }
  6204. æDT RemoveHdlBlocks;
  6205. æC 
  6206.  
  6207. æKY GetNodeAddress
  6208. æFp AppleTalk.p
  6209. æT FUNCTION
  6210. æD FUNCTION GetNodeAddress(VAR myNode: INTEGER;VAR myNet: INTEGER): OSErr;
  6211. æDT myVariable := GetNodeAddress(myNode,myNet);
  6212. æRI II-303
  6213. æC 
  6214. GetNodeAddress returns the current node ID and network number of the caller. If the
  6215. .MPP driver isn’t installed, it returns noMPPErr. If myNet contains 0, this means
  6216. that a bridge hasn’t yet been found.
  6217.  
  6218. Result codes    noErr       No error
  6219.                 noMPPErr    MPP driver not installed
  6220.  
  6221. æKY IsMPPOpen
  6222. æFp AppleTalk.p
  6223. æT FUNCTION
  6224. æD FUNCTION IsMPPOpen: BOOLEAN;
  6225. æDT myVariable := IsMPPOpen;
  6226. æRI II-304
  6227. æC 
  6228. [Not in ROM]
  6229.  
  6230. IsMPPOpen returns TRUE if the .MPP driver is loaded and running.
  6231.  
  6232. æKY IsATPOpen
  6233. æFp AppleTalk.p
  6234. æT FUNCTION
  6235. æD FUNCTION IsATPOpen: BOOLEAN;
  6236. { IsATPOpen : BOOLEAN;   [Not in ROM]
  6237.  
  6238. IsATPOpen returns TRUE if the .ATP driver is loaded and running.
  6239.  
  6240.  
  6241.  }
  6242. æDT myVariable := IsATPOpen;
  6243. æRI II-304
  6244. æC 
  6245. [Not in ROM]
  6246.  
  6247. IsATPOpen returns TRUE if the .ATP driver is loaded and running.
  6248.  
  6249.  
  6250. æKY Balloons.p
  6251. æKL HMBalloonRect
  6252. HMBaloonPict
  6253. HMExtractHelpMsg
  6254. HMFillCitationString
  6255. HMGetBalloons
  6256. HMGetDialogResID
  6257. HMGetFont
  6258. HMGetFontSize
  6259. HMGetMenuResID
  6260. HMIsBalloon
  6261. HMMouseInApplRgn
  6262. HMRemoveBalloon
  6263. HMScanTemplateItems
  6264. HMSetBalloons
  6265. HMSetDialogResID
  6266. HMSetFont
  6267. HMSetFontSize
  6268. HMSetMenuResID
  6269. HMShowBalloon
  6270. HMShowMenuBalloon
  6271. HMState
  6272.  
  6273. hdlgLocalCoords
  6274. hdlgSaveBits
  6275. hdlgUseSubID
  6276. helpItem
  6277. hmBadSelector
  6278. hmBalloonAborted
  6279. HMCompareItem
  6280. hmCouldNotLoadPackage
  6281. HMDefaultRecord
  6282. HMDefaultRecPtr
  6283. hmGestaltBalloonsOff
  6284. hmGestaltBalloonsOn
  6285. hmGestaltHelpType
  6286. hmHelpDisabled
  6287. HMLHHandleType
  6288. hmMemFullErr
  6289. HMMessageRecord
  6290. HMMessageRecordPtr
  6291. HMNamedResourceItem
  6292. HMPicHDefaultRecord
  6293. HMPicHDefaultRecPtr
  6294. HMPicHMsgRecord
  6295. HMPicHMsgRecPtr
  6296. HMPictDefaultRecord
  6297. HMPictDefaultRecPtr
  6298. HMPictItem
  6299. HMPictMsgRecord
  6300. HMPictMsgRecPtr
  6301. hmResNotFound
  6302. hmSameAsLastBalloon
  6303. HMSkipItem
  6304. hmSkippedBalloon
  6305. HMSTHandleType
  6306. HMStringDefaultRecord
  6307. HMStringDefaultRecPtr
  6308. HMStringItem
  6309. HMStringMsgRecord
  6310. HMStringMsgRecPtr
  6311. HMStringRecord
  6312. HMStringResItem
  6313. HMStringResType
  6314. HMStrResDefaultRecord
  6315. HMStrResDefaultRecPtr
  6316. HMSTRResItem
  6317. HMStrResMsgRecord
  6318. HMStrResMsgRecPtr
  6319. HMTEHDefaultRecord
  6320. HMTEHDefaultRecPtr
  6321. HMTEHMsgRecord
  6322. HMTEHMsgRecPtr
  6323. HMTEResItem
  6324. HMTEResType
  6325. HMTEStyleType
  6326. HMTrackCntlItem
  6327. hmUnknownHelpType
  6328. HMVersionWord
  6329. hmWrongVersion
  6330. hwinUseResID
  6331. hwinUseSubID
  6332. kBalloonWDEFID
  6333. kHMAboutHelpID
  6334. kHMChecked
  6335. kHMCheckedItem
  6336. kHMDisabled
  6337. kHMDisabledItem
  6338. kHMEasy1Access
  6339. kHMEasy2Access
  6340. kHMEasy3Access
  6341. kHMEnabled
  6342. kHMEnabledItem
  6343. kHMHelpIconOff
  6344. kHMHelpIconOn
  6345. kHMHelpID
  6346. kHMHelpMenuID
  6347. kHMhrctAbsolute
  6348. kHMInDisabledScrollBar
  6349. kHMInDragIndex
  6350. kHMInGoAwayIndex
  6351. kHMInGrowIndex
  6352. kHMInScrollBar
  6353. kHMInZoomIndex
  6354. kHMMenuTitleIndex
  6355. khmmPict
  6356. khmmPictHandle
  6357. khmmString
  6358. khmmStringRes
  6359. khmmSTRRes
  6360. khmmTEHandle
  6361. khmmTERes
  6362. kHMMultiFinderIndex
  6363. kHMOther
  6364. kHMOtherItem
  6365. kHMUsingHelpIndex
  6366. kHMUsingHelpItem
  6367. kHMWhatIsIndex
  6368. kHMWhatIsItem
  6369. RectPtr
  6370.  
  6371. æKY HMVersionWord
  6372. æFp Balloons.p
  6373. æT CONST
  6374. æD HMVersionWord = $0002;
  6375. æC 
  6376.  
  6377. æKY hmHelpDisabled
  6378. æFp Balloons.p
  6379. æT CONST
  6380. æD 
  6381. { Help Mgr error range: -850 to -874 }
  6382.  
  6383. hmHelpDisabled = -850;
  6384. æC 
  6385.  
  6386. æKY hmResNotFound
  6387. æFp Balloons.p
  6388. æT CONST
  6389. æD hmResNotFound = -851;
  6390. æC 
  6391.  
  6392. æKY hmMemFullErr
  6393. æFp Balloons.p
  6394. æT CONST
  6395. æD hmMemFullErr = -852;
  6396. æC 
  6397.  
  6398. æKY hmBalloonAborted
  6399. æFp Balloons.p
  6400. æT CONST
  6401. æD hmBalloonAborted = -853;
  6402. æC 
  6403.  
  6404. æKY hmSameAsLastBalloon
  6405. æFp Balloons.p
  6406. æT CONST
  6407. æD hmSameAsLastBalloon = -854;
  6408. æC 
  6409.  
  6410. æKY hmBadSelector
  6411. æFp Balloons.p
  6412. æT CONST
  6413. æD hmBadSelector = -856;
  6414. æC 
  6415.  
  6416. æKY hmSkippedBalloon
  6417. æFp Balloons.p
  6418. æT CONST
  6419. æD hmSkippedBalloon = -857;
  6420. æC 
  6421.  
  6422. æKY hmWrongVersion
  6423. æFp Balloons.p
  6424. æT CONST
  6425. æD hmWrongVersion = -858;
  6426. æC 
  6427.  
  6428. æKY hmUnknownHelpType
  6429. æFp Balloons.p
  6430. æT CONST
  6431. æD hmUnknownHelpType = -859;
  6432. æC 
  6433.  
  6434. æKY hmCouldNotLoadPackage
  6435. æFp Balloons.p
  6436. æT CONST
  6437. æD hmCouldNotLoadPackage = -860;
  6438. æC 
  6439.  
  6440. æKY hmGestaltHelpType
  6441. æFp Balloons.p
  6442. æT CONST
  6443. æD 
  6444. { Gestalt }
  6445.  
  6446. hmGestaltHelpType = 'help';
  6447. æC 
  6448.  
  6449. æKY hmGestaltBalloonsOn
  6450. æFp Balloons.p
  6451. æT CONST
  6452. æD hmGestaltBalloonsOn = 0;
  6453. æC 
  6454.  
  6455. æKY hmGestaltBalloonsOff
  6456. æFp Balloons.p
  6457. æT CONST
  6458. æD hmGestaltBalloonsOff = 1;
  6459. æC 
  6460.  
  6461. æKY kHMUsingHelpItem
  6462. æFp Balloons.p
  6463. æT CONST
  6464. æD kHMUsingHelpItem = 1;
  6465. æC 
  6466.  
  6467. æKY kHMWhatIsItem
  6468. æFp Balloons.p
  6469. æT CONST
  6470. æD kHMWhatIsItem = 3;
  6471. æC 
  6472.  
  6473. æKY kHMHelpID
  6474. æFp Balloons.p
  6475. æT CONST
  6476. æD kHMHelpID = -5696;
  6477. æC 
  6478.  
  6479. æKY kHMMultiFinderIndex
  6480. æFp Balloons.p
  6481. æT CONST
  6482. æD 
  6483. {  System STR# resource indexes  }
  6484.  
  6485. kHMMultiFinderIndex = 1;
  6486. æC 
  6487.  
  6488. æKY kHMMenuTitleIndex
  6489. æFp Balloons.p
  6490. æT CONST
  6491. æD kHMMenuTitleIndex = 2;
  6492. æC 
  6493.  
  6494. æKY kHMUsingHelpIndex
  6495. æFp Balloons.p
  6496. æT CONST
  6497. æD kHMUsingHelpIndex = 3;
  6498. æC 
  6499.  
  6500. æKY kHMWhatIsIndex
  6501. æFp Balloons.p
  6502. æT CONST
  6503. æD kHMWhatIsIndex = 4;
  6504. æC 
  6505.  
  6506. æKY kHMInDragIndex
  6507. æFp Balloons.p
  6508. æT CONST
  6509. æD kHMInDragIndex = 5;
  6510. æC 
  6511.  
  6512. æKY kHMInGrowIndex
  6513. æFp Balloons.p
  6514. æT CONST
  6515. æD kHMInGrowIndex = 6;
  6516. æC 
  6517.  
  6518. æKY kHMInGoAwayIndex
  6519. æFp Balloons.p
  6520. æT CONST
  6521. æD kHMInGoAwayIndex = 7;
  6522. æC 
  6523.  
  6524. æKY kHMInZoomIndex
  6525. æFp Balloons.p
  6526. æT CONST
  6527. æD kHMInZoomIndex = 8;
  6528. æC 
  6529.  
  6530. æKY kHMInScrollBar
  6531. æFp Balloons.p
  6532. æT CONST
  6533. æD kHMInScrollBar = 9;
  6534. æC 
  6535.  
  6536. æKY kHMInDisabledScrollBar
  6537. æFp Balloons.p
  6538. æT CONST
  6539. æD kHMInDisabledScrollBar = 10;
  6540. æC 
  6541.  
  6542. æKY kHMEasy1Access
  6543. æFp Balloons.p
  6544. æT CONST
  6545. æD kHMEasy1Access = 11;
  6546. æC 
  6547.  
  6548. æKY kHMEasy2Access
  6549. æFp Balloons.p
  6550. æT CONST
  6551. æD kHMEasy2Access = 12;
  6552. æC 
  6553.  
  6554. æKY kHMEasy3Access
  6555. æFp Balloons.p
  6556. æT CONST
  6557. æD kHMEasy3Access = 13;
  6558. æC 
  6559.  
  6560. æKY kHMAboutHelpID
  6561. æFp Balloons.p
  6562. æT CONST
  6563. æD 
  6564. { misc Constants }
  6565.  
  6566. kHMAboutHelpID = -5696;
  6567. æC 
  6568.  
  6569. æKY kHMHelpMenuID
  6570. æFp Balloons.p
  6571. æT CONST
  6572. æD kHMHelpMenuID = -5696;
  6573. æC 
  6574.  
  6575. æKY kHMHelpIconOn
  6576. æFp Balloons.p
  6577. æT CONST
  6578. æD kHMHelpIconOn = -5696;
  6579. æC 
  6580.  
  6581. æKY kHMHelpIconOff
  6582. æFp Balloons.p
  6583. æT CONST
  6584. æD kHMHelpIconOff = -5695;
  6585. æC 
  6586.  
  6587. æKY kBalloonWDEFID
  6588. æFp Balloons.p
  6589. æT CONST
  6590. æD 
  6591. { WhatIs default WDEF res ID }
  6592.  
  6593. kBalloonWDEFID = 126;
  6594. æC 
  6595.  
  6596. æKY helpItem
  6597. æFp Balloons.p
  6598. æT CONST
  6599. æD 
  6600. { Dialog item template type }
  6601.  
  6602. helpItem = 1;
  6603. æC 
  6604.  
  6605. æKY kHMhrctAbsolute
  6606. æFp Balloons.p
  6607. æT CONST
  6608. æD 
  6609. { hrct Options }
  6610.  
  6611. kHMhrctAbsolute = 0;
  6612. æC 
  6613.  
  6614. æKY kHMEnabledItem
  6615. æFp Balloons.p
  6616. æT CONST
  6617. æD 
  6618. { Generic defines for the switch items used in 'hmnu' & 'hdlg' }
  6619.  
  6620. kHMEnabledItem = 0;
  6621. æC 
  6622.  
  6623. æKY kHMDisabledItem
  6624. æFp Balloons.p
  6625. æT CONST
  6626. æD kHMDisabledItem = 1;
  6627. æC 
  6628.  
  6629. æKY kHMCheckedItem
  6630. æFp Balloons.p
  6631. æT CONST
  6632. æD kHMCheckedItem = 2;
  6633. æC 
  6634.  
  6635. æKY kHMOtherItem
  6636. æFp Balloons.p
  6637. æT CONST
  6638. æD kHMOtherItem = 3;
  6639. æC 
  6640.  
  6641. æKY hdlgUseSubID
  6642. æFp Balloons.p
  6643. æT CONST
  6644. æD hdlgUseSubID = 0; { if set then use sub ID's to fine res ID}
  6645. æC 
  6646.  
  6647. æKY hdlgLocalCoords
  6648. æFp Balloons.p
  6649. æT CONST
  6650. æD hdlgLocalCoords = 1; { if set then use hdlg rects as local coords, ignoring item rects}
  6651. æC 
  6652.  
  6653. æKY hdlgSaveBits
  6654. æFp Balloons.p
  6655. æT CONST
  6656. æD hdlgSaveBits = 2; { if set then use save bits behind balloon}
  6657. æC 
  6658.  
  6659. æKY hwinUseResID
  6660. æFp Balloons.p
  6661. æT CONST
  6662. æD 
  6663. { Option bits for hwin resources }
  6664.  
  6665. hwinUseResID = 0;
  6666. æC 
  6667.  
  6668. æKY hwinUseSubID
  6669. æFp Balloons.p
  6670. æT CONST
  6671. æD hwinUseSubID = 1;
  6672. æC 
  6673.  
  6674. æKY HMStringItem
  6675. æFp Balloons.p
  6676. æT CONST
  6677. æD 
  6678. { Constants for Help Types in 'hmnu', 'hdlg', 'hrct' resources }
  6679.  
  6680. HMStringItem = 1;
  6681. æC 
  6682.  
  6683. æKY HMPictItem
  6684. æFp Balloons.p
  6685. æT CONST
  6686. æD HMPictItem = 2;
  6687. æC 
  6688.  
  6689. æKY HMStringResItem
  6690. æFp Balloons.p
  6691. æT CONST
  6692. æD HMStringResItem = 3;
  6693. æC 
  6694.  
  6695. æKY HMTEResItem
  6696. æFp Balloons.p
  6697. æT CONST
  6698. æD HMTEResItem = 6;
  6699. æC 
  6700.  
  6701. æKY HMSTRResItem
  6702. æFp Balloons.p
  6703. æT CONST
  6704. æD HMSTRResItem = 7;
  6705. æC 
  6706.  
  6707. æKY HMSkipItem
  6708. æFp Balloons.p
  6709. æT CONST
  6710. æD HMSkipItem = 256;
  6711. æC 
  6712.  
  6713. æKY HMCompareItem
  6714. æFp Balloons.p
  6715. æT CONST
  6716. æD HMCompareItem = 512;
  6717. æC 
  6718.  
  6719. æKY HMNamedResourceItem
  6720. æFp Balloons.p
  6721. æT CONST
  6722. æD HMNamedResourceItem = 1024;
  6723. æC 
  6724.  
  6725. æKY HMTrackCntlItem
  6726. æFp Balloons.p
  6727. æT CONST
  6728. æD HMTrackCntlItem = 2048;
  6729. æC 
  6730.  
  6731. æKY khmmString
  6732. æFp Balloons.p
  6733. æT CONST
  6734. æD 
  6735. { Constants for hmmHelpType's when filling out HMMessageRecord }
  6736.  
  6737. khmmString = 1;
  6738. æC 
  6739.  
  6740. æKY khmmPict
  6741. æFp Balloons.p
  6742. æT CONST
  6743. æD khmmPict = 2;
  6744. æC 
  6745.  
  6746. æKY khmmStringRes
  6747. æFp Balloons.p
  6748. æT CONST
  6749. æD khmmStringRes = 3;
  6750. æC 
  6751.  
  6752. æKY khmmTEHandle
  6753. æFp Balloons.p
  6754. æT CONST
  6755. æD khmmTEHandle = 4;
  6756. æC 
  6757.  
  6758. æKY khmmPictHandle
  6759. æFp Balloons.p
  6760. æT CONST
  6761. æD khmmPictHandle = 5;
  6762. æC 
  6763.  
  6764. æKY khmmTERes
  6765. æFp Balloons.p
  6766. æT CONST
  6767. æD khmmTERes = 6;
  6768. æC 
  6769.  
  6770. æKY khmmSTRRes
  6771. æFp Balloons.p
  6772. æT CONST
  6773. æD khmmSTRRes = 7;
  6774. æC 
  6775.  
  6776. æKY kHMEnabled
  6777. æFp Balloons.p
  6778. æT CONST
  6779. æD kHMEnabled = 1;
  6780. æC 
  6781.  
  6782. æKY kHMDisabled
  6783. æFp Balloons.p
  6784. æT CONST
  6785. æD kHMDisabled = 2;
  6786. æC 
  6787.  
  6788. æKY kHMChecked
  6789. æFp Balloons.p
  6790. æT CONST
  6791. æD kHMChecked = 4;
  6792. æC 
  6793.  
  6794. æKY kHMOther
  6795. æFp Balloons.p
  6796. æT CONST
  6797. æD kHMOther = 8;
  6798. æC 
  6799.  
  6800. æKY HMTEResType
  6801. æFp Balloons.p
  6802. æT CONST
  6803. æD 
  6804. { ResTypes for Styled TE Handles when extracting from Resources }
  6805.  
  6806. HMTEResType = 'thdl';
  6807. æC 
  6808.  
  6809. æKY HMTEStyleType
  6810. æFp Balloons.p
  6811. æT CONST
  6812. æD HMTEStyleType = 'tsty';
  6813. æC 
  6814.  
  6815. æKY HMSTHandleType
  6816. æFp Balloons.p
  6817. æT CONST
  6818. æD HMSTHandleType = 'tstb';
  6819. æC 
  6820.  
  6821. æKY HMLHHandleType
  6822. æFp Balloons.p
  6823. æT CONST
  6824. æD HMLHHandleType = 'thtb';
  6825. æC 
  6826.  
  6827. æKY RectPtr
  6828. æFp Balloons.p
  6829. æT RECORD
  6830. æD RectPtr = ^Rect;
  6831. æC 
  6832.  
  6833. æKY HMStringResType
  6834. æFp Balloons.p
  6835. æT RECORD
  6836. æD HMStringResType = PACKED RECORD
  6837.     hmmResID: INTEGER;
  6838.     hmmIndex: INTEGER;
  6839.     END;
  6840. æC 
  6841.  
  6842. æKY HMStringMsgRecord
  6843. HMStringMsgRecPtr
  6844. æFp Balloons.p
  6845. æT RECORD
  6846. æD HMStringMsgRecPtr = ^HMStringMsgRecord;
  6847. HMStringMsgRecord = RECORD
  6848.     hmmHelpType: INTEGER;
  6849.     hmmString: Str255;
  6850.     END;
  6851. æC 
  6852.  
  6853. æKY HMPictMsgRecord
  6854. HMPictMsgRecPtr
  6855. æFp Balloons.p
  6856. æT RECORD
  6857. æD HMPictMsgRecPtr = ^HMPictMsgRecord;
  6858. HMPictMsgRecord = RECORD
  6859.     hmmHelpType: INTEGER;
  6860.     hmmPict: INTEGER;
  6861.     fill: ARRAY [0..253] OF Byte;
  6862.     END;
  6863. æC 
  6864.  
  6865. æKY HMTEHMsgRecord
  6866. HMTEHMsgRecPtr
  6867. æFp Balloons.p
  6868. æT RECORD
  6869. æD HMTEHMsgRecPtr = ^HMTEHMsgRecord;
  6870. HMTEHMsgRecord = RECORD
  6871.     hmmHelpType: INTEGER;
  6872.     hmmTEHandle: Handle;
  6873.     fill: ARRAY [0..251] OF Byte;
  6874.     END;
  6875. æC 
  6876.  
  6877. æKY HMStrResMsgRecord
  6878. HMStrResMsgRecPtr
  6879. æFp Balloons.p
  6880. æT RECORD
  6881. æD HMStrResMsgRecPtr = ^HMStrResMsgRecord;
  6882. HMStrResMsgRecord = RECORD
  6883.     hmmHelpType: INTEGER;
  6884.     hmmStrRes: HMStrResType;
  6885.     fill: ARRAY [0..249] OF Byte;
  6886.     END;
  6887. æC 
  6888.  
  6889. æKY HMPicHMsgRecord
  6890. HMPicHMsgRecPtr
  6891. æFp Balloons.p
  6892. æT RECORD
  6893. æD HMPicHMsgRecPtr = ^HMPicHMsgRecord;
  6894. HMPicHMsgRecord = RECORD
  6895.     hmmHelpType: INTEGER;
  6896.     hmmPicHandle: PicHandle;
  6897.     fill: ARRAY [0..251] OF Byte;
  6898.     END;
  6899. æC 
  6900.  
  6901. æKY HMDefaultRecord
  6902. HMDefaultRecPtr
  6903. æFp Balloons.p
  6904. æT RECORD
  6905. æD HMDefaultRecPtr = ^HMDefaultRecord;
  6906. HMDefaultRecord = RECORD
  6907.     hmVersion: INTEGER;
  6908.     hmDefMessage: HMStringMsgRecord;
  6909.     hmHelpVRefNum: INTEGER;
  6910.     hmHelpDirID: LONGINT;
  6911.     hmSearchAlternateFiles: BOOLEAN;
  6912.     END;
  6913. æC 
  6914.  
  6915. æKY HMStringDefaultRecord
  6916. HMStringDefaultRecPtr
  6917. æFp Balloons.p
  6918. æT RECORD
  6919. æD HMStringDefaultRecPtr = ^HMStringDefaultRecord;
  6920. HMStringDefaultRecord = RECORD
  6921.     hmVersion: INTEGER;
  6922.     hmDefMessage: HMStringMsgRecord;
  6923.     hmHelpVRefNum: INTEGER;
  6924.     hmHelpDirID: LONGINT;
  6925.     hmSearchAlternateFiles: BOOLEAN;
  6926.     END;
  6927. æC 
  6928.  
  6929. æKY HMPictDefaultRecord
  6930. HMPictDefaultRecPtr
  6931. æFp Balloons.p
  6932. æT RECORD
  6933. æD HMPictDefaultRecPtr = ^HMPictDefaultRecord;
  6934. HMPictDefaultRecord = RECORD
  6935.     hmVersion: INTEGER;
  6936.     hmDefMessage: HMPictMsgRecord;
  6937.     hmHelpVRefNum: INTEGER;
  6938.     hmHelpDirID: LONGINT;
  6939.     hmSearchAlternateFiles: BOOLEAN;
  6940.     END;
  6941. æC 
  6942.  
  6943. æKY HMTEHDefaultRecord
  6944. HMTEHDefaultRecPtr
  6945. æFp Balloons.p
  6946. æT RECORD
  6947. æD HMTEHDefaultRecPtr = ^HMTEHDefaultRecord;
  6948. HMTEHDefaultRecord = RECORD
  6949.     hmVersion: INTEGER;
  6950.     hmDefMessage: HMTEHMsgRecord;
  6951.     hmHelpVRefNum: INTEGER;
  6952.     hmHelpDirID: LONGINT;
  6953.     hmSearchAlternateFiles: BOOLEAN;
  6954.     END;
  6955. æC 
  6956.  
  6957. æKY HMStrResDefaultRecord
  6958. HMStrResDefaultRecPtr
  6959. æFp Balloons.p
  6960. æT RECORD
  6961. æD HMStrResDefaultRecPtr = ^HMStrResDefaultRecord;
  6962. HMStrResDefaultRecord = RECORD
  6963.     hmVersion: INTEGER;
  6964.     hmDefMessage: HMStrResMsgRecord;
  6965.     hmHelpVRefNum: INTEGER;
  6966.     hmHelpDirID: LONGINT;
  6967.     hmSearchAlternateFiles: BOOLEAN;
  6968.     END;
  6969. æC 
  6970.  
  6971. æKY HMPicHDefaultRecord
  6972. HMPicHDefaultRecPtr
  6973. æFp Balloons.p
  6974. æT RECORD
  6975. æD HMPicHDefaultRecPtr = ^HMPicHDefaultRecord;
  6976. HMPicHDefaultRecord = RECORD
  6977.     hmVersion: INTEGER;
  6978.     hmDefMessage: HMPicHMsgRecord;
  6979.     hmHelpVRefNum: INTEGER;
  6980.     hmHelpDirID: LONGINT;
  6981.     hmSearchAlternateFiles: BOOLEAN;
  6982.     END;
  6983. æC 
  6984.  
  6985. æKY HMStringRecord
  6986. æFp Balloons.p
  6987. æT RECORD
  6988. æD HMStringRecord = RECORD
  6989.     hmmHelpType: INTEGER;
  6990.     hmmFont: INTEGER;
  6991.     hmmFontSize: INTEGER;
  6992.     hmmMessage: ARRAY [0..255] OF Byte;
  6993.     END;
  6994. æC 
  6995.  
  6996. æKY HMMessageRecord
  6997. HMMessageRecordPtr
  6998. æFp Balloons.p
  6999. æT RECORD
  7000. æD HMMessageRecordPtr = ^HMMessageRecord;
  7001. HMMessageRecord = RECORD
  7002.     hmmHelpType: Integer;
  7003.     CASE Integer OF
  7004.       khmmString:
  7005.         (hmmString: Str255;
  7006.           );
  7007.           khmmPict:
  7008.             (hmmPict: Integer;
  7009.               );
  7010.               khmmStringRes:
  7011.                 (hmmStringRes: HMStringResType;
  7012.                   );
  7013.                   khmmTEHandle:
  7014.                     (hmmTRHandle: TEHandle;
  7015.                       );
  7016.                       khmmPictHandle:
  7017.                         (hmmPictHandle: PicHandle;
  7018.                           );
  7019.                           khmmTERes:
  7020.                             (hmmTERes: Integer;
  7021.                               );
  7022.                               khmmSTRRes:
  7023.                                 (hmmSTRRes: Integer;
  7024.                                   );
  7025.     END;
  7026. æC 
  7027.  
  7028.  
  7029. æKY HMState
  7030. æFp Balloons.p
  7031. æT FUNCTION
  7032. æD FUNCTION HMState(VAR state: HMStateRecord): OSErr;
  7033.     INLINE $303C,$0200,_Pack14;
  7034. æDT myVariable := HMState(state);
  7035. æC 
  7036.  
  7037. æKY HMShowBalloon
  7038. æFp Balloons.p
  7039. æT FUNCTION
  7040. æD FUNCTION HMShowBalloon(aHelpMsg: HMMessageRecord;tip: Point;VAR alternateRect: Rect;
  7041.     tipProc: Ptr;theProc: INTEGER;variant: INTEGER;saveBits: BOOLEAN): INTEGER;
  7042.     INLINE $303C,$0B01,_Pack14;
  7043. æDT myVariable := HMShowBalloon(aHelpMsg,tip,alternateRect,tipProc,theProc,variant,saveBits);
  7044. æC 
  7045. If help is enabled, you can use the HMShowBalloon function to display a balloon
  7046. containing the message specified by the message parameter; the balloon’s tip is
  7047. located at the point specified by the tip parameter.
  7048.  
  7049. Use the HMShowBalloon function to display a help message for an item that the
  7050. user can move. Use the HMShowMenuBalloon function to display help messages for
  7051. your application’s non-standard menus.
  7052.  
  7053. Parameter  Description
  7054. message    specifies the help message to be displayed. The HMMessageRecord
  7055.            data type is described in “The Help Message Record” earlier
  7056.            in this chapter.
  7057.  
  7058. tip        specifies, in global coordinates, the point where you want to 
  7059.            position the balloon’s tip.  For additional information about how 
  7060.            the Help Manager positions balloons, see “How the Help Manager 
  7061.            Positions the Help Balloon” earlier in this chapter.
  7062.  
  7063. hotRect    defines the area for which a specific help message is owned. That
  7064.            is, if the user moves the cursor anywhere outside the area specified
  7065.            by the hotRect parameter (once a balloon has been displayed), the
  7066.            Help Manager will remove the balloon This area is also the area of
  7067.            drift for the balloon tip. That is, if your specification for the
  7068.            tip parameter would force the Help Manager to position a balloon so
  7069.            that it obscures the element to be explained or so that it spills 
  7070.            off the screen, the Help Manager attempts to relocate the tip within
  7071.            the area defined by the hotRect parameter. See “How the Help Manager
  7072.            Positions the Help Balloon” earlier in this chapter for additional
  7073.            information.
  7074.  
  7075. tipProc    specifies the address of a procedure you write that tests the 
  7076.            values of the tip position and the balloon rectangle calculated by 
  7077.            the Help Manager. You would write such a procedure if you anticipated
  7078.            problems positioning a help balloon. Using this function gives the 
  7079.            application one more chance to modify the balloon’s position or
  7080.            dimensions before displaying it.  Pass NIL for the tipProc parameter
  7081.            if you want the Help Manager to ignore the HMBaloonHook function. For
  7082.            additional information, see “Testing the Tip Position and the 
  7083.            Dimensions of the Help Balloon” earlier in this chapter for 
  7084.            additional information.
  7085.  
  7086. theProc    specifies the resource ID of the window definition procedure
  7087.            that you want the Help Manager to use to define the help balloon 
  7088.            shape. The Help Manager reads the ‘WDEF’ resource into memory if it’s
  7089.            not already in memory.  If the Help Manager cannot find or read the
  7090.            resource, the balloon is not displayed and the function returns the
  7091.            system error -192, resNotFound. To use the Help Manager’s default
  7092.            balloon shape, pass 0 for both the procedure and the variant 
  7093.            parameter.
  7094.  
  7095. variant    specifies the variation code for the window definition
  7096.            procedure specified by the parameter theProc. If you specify 0 
  7097.            for the parameter theProc, you can still specify a value for 
  7098.            variant to indicate a preferred tip position for the default
  7099.            balloon. See "Defining Your Own Balloon Shape" earlier in 
  7100.            this chapter for additional information.
  7101.  
  7102. saveBits   a value of TRUE specifies that the Help Manager should save the
  7103.            bits behind the balloon.  Only use the saveBits option if you are
  7104.            certain that the bits behind the balloon will still be valid when
  7105.            the balloon is removed; as would be the case, for example, with 
  7106.            the bits behind a pulled down menu.  
  7107.            
  7108.            A value of FALSE specifies that the Window Manager should generate
  7109.            an update event for the window behind the balloon when you remove the
  7110.  
  7111.            balloon.
  7112.  
  7113.            You must specify FALSE for saveBits if the parameter theProc is
  7114.            non-zero,that is, if you are defining your own balloon shape.
  7115.  
  7116. The HMShowBalloon function returns the noErr result if the Help Manager displays
  7117. a balloon. If help was disabled or if no balloon was displayed, the function
  7118. returns a non-zero result.
  7119.  
  7120. Result codes
  7121. noErr                      0  No error
  7122. paramErr                 –50  Bad parameters passed in message record
  7123. memFullErr              –108  Not enough room in heap zone
  7124. resNotFound             –192  The balloon ‘WDEF’ could not be read
  7125. hmHelpDisabled          –850  Help is disabled
  7126. hmBalloonAborted        –853  Cursor was not stationary
  7127. hmCouldnotLoadPackage   –860  There was not enough memory to load
  7128.                               package
  7129. hmOperationUnsupported  –861  Could not interpret call
  7130.  
  7131. æKY HMRemoveBalloon
  7132. æFp Balloons.p
  7133. æT FUNCTION
  7134. æD FUNCTION HMRemoveBalloon: INTEGER;
  7135.     INLINE $303C,$0002,_Pack14;
  7136. æDT myVariable := HMRemoveBalloon(paramList);
  7137. æC 
  7138. FUNCTION HMRemoveBalloon : OSErr;
  7139.  
  7140. The HMRemoveBalloon function removes any help message that is currently visible.
  7141. If no help message is visible, the HMRemoveBalloon function does nothing.  Use
  7142. the HMRemoveBalloon function to remove balloons created either by HMShowBalloon
  7143. or HMShowMenuBalloon. 
  7144.  
  7145. If a balloon is visible and the user disables help, the Help Manager calls this
  7146. function automatically.  The Help Manager also calls the HMRemoveBalloon
  7147. function so that no more than one help balloon is displayed at any time. Thus if
  7148. your application makes successive calls to show balloons without calling the
  7149. HMRemoveBalloon function, the Help Manager calls the HMRemoveBalloon function
  7150. automatically to remove the first balloon before displaying the second balloon.
  7151.  
  7152. If your application has called the HMShowBalloon function to display a help
  7153. message and the hotRect parameter was NIL, call the HMRemoveBalloon function
  7154. when the cursor moves out of the specified area. In a customized 'MDEF'
  7155. definition procedure, call the HMRemoveBalloon function before hiding a drawn
  7156. menu. In a customized 'MBDF' procedure, call the HMRemoveBalloon function in
  7157. response to the messages SaveBits and RestoreBits before saving or restoring any
  7158. bits.
  7159.  
  7160. Results codes
  7161. noErr                      0  No error; a balloon was removed
  7162. paramErr                 –50  Bad parameters passed in message record
  7163. hmHelpDisabled          –850  Balloon help is disabled
  7164. hmCouldnotLoadPackage   –860  There was not enough memory to load
  7165.                               package
  7166. hmOperationUnsupported  –861  Could not interpret call
  7167.  
  7168. æKY HMGetBalloons
  7169. æFp Balloons.p
  7170. æT FUNCTION
  7171. æD FUNCTION HMGetBalloons: BOOLEAN;
  7172.     INLINE $303C,$0003,_Pack14;
  7173. æDT myVariable := HMGetBalloons(paramList);
  7174. æC 
  7175. The HMGetBalloons function returns the current setting of the flag parameter for
  7176. the HMSetBalloons function.
  7177.  
  7178.  
  7179. æKY HMSetBalloons
  7180. æFp Balloons.p
  7181. æT FUNCTION
  7182. æD FUNCTION HMSetBalloons(flag: BOOLEAN): INTEGER;
  7183.     INLINE $303C,$0104,_Pack14;
  7184. æDT myVariable := HMSetBalloons(flag);
  7185. æC 
  7186. The following routine allows you to set a flag that activates balloon help, find
  7187. out the current setting of this flag, and determine whether a help balloon is
  7188. being displayed on the screen.
  7189.  
  7190. FUNCTION HMSetBalloons (flag: Boolean) : OSErr;
  7191.  
  7192. Calling the HMSetBalloons function activates the Help Manager if the value of
  7193. the flag parameter is TRUE and turns it off if the value of flag is FALSE.  When
  7194. help is enabled, the Help Manager automatically displays balloons for standard
  7195. window parts and system dialog boxes. Disabling help removes any balloon
  7196. displayed by calls to the HMShowBalloon or HMShowMenuBalloon functions. 
  7197.  
  7198. Result codes
  7199. noErr                     0  No error
  7200. hmCouldnotLoadPackage  –860  There was not enough memory to load
  7201.                               package
  7202. hmOperationUnsupported  –861  Could not interpret call
  7203.  
  7204. æKY HMShowMenuBalloon
  7205. æFp Balloons.p
  7206. æT FUNCTION
  7207. æD FUNCTION HMShowMenuBalloon(itemNum: INTEGER;itemMenuID: INTEGER;itemFlags: LONGINT;
  7208.     itemReserved: LONGINT;tip: Point;alternateRect: Ptr;tipProc: Ptr;theProc: INTEGER;
  7209.     variant: INTEGER): INTEGER;
  7210.     INLINE $303C,$0E05,_Pack14;
  7211. æDT myVariable := HMShowMenuBalloon(itemNum,itemMenuID,itemFlags,itemReserved,tip,alternateRect,tipProc,theProc,variant);
  7212. æC 
  7213. FUNCTION HMShowMenuBalloon (itemNum: Integer; itemMenuID: Integer;
  7214.             itemFlags: LongInt; itemReserved: LongInt; 
  7215.             tip: Point; hotRect: rectPtr; tipProc: Ptr;       
  7216.             reserved, reserved: Integer) : OSErr;
  7217.  
  7218. The HMShowMenuBalloon function allows you to display help balloons for an
  7219. application's non-standard menu. You call the HMShowMenuBalloon function from 
  7220. a menu’s ‘MDEF’ definition procedure right after drawing, highlighting, or
  7221. determining that the cursor is over a menu item.
  7222.  
  7223. Parameter   Description
  7224. itemNum     specifies the number of the menu item to which the cursor is 
  7225.             pointing. If the cursor points to the menu title, the itemNum 
  7226.             parameter contains 0;if the cursor points to a dashed line, the 
  7227.             itemNum parameter contains -1.
  7228.  
  7229. itemMenuID  specifies the menuID of the menu currently in use.
  7230.  
  7231. itemFlags   specifies the menu's enabledFlags Longword, which tells the Help
  7232.             Manager whether the menu item is enabled or disabled. The Help 
  7233.             Manager uses this value to select the corresponding message
  7234.             from the ‘hmnu’ resource associated with the menu specified by 
  7235.             itemMenuID.
  7236.  
  7237. itemReserved  reserved for future expansion; specify 0
  7238.  
  7239. tip         specifies, in global coordinates, the point where you want the
  7240.             balloon’s tip.  For additional information about how the Help 
  7241.             Manager positions balloons, see “How the Help Manager Positions 
  7242.             the Help Balloon” earlier in this chapter.
  7243.  
  7244. hotRect     specifies the area of drift for the balloon tip. That is, if
  7245.             your specification for the tip parameter would force the Help
  7246.             Manager to position a balloon so that it obscures the element to 
  7247.             be explained or so that it spills off the screen, the Help Manager
  7248.             attempts to relocate the tip within the area defined by the
  7249.             hotRect.parameter. See “How the Help Manager Positions the Help 
  7250.             Balloon” earlier in this chapter for additional information.
  7251.  
  7252. tipProc     specifies the address of a procedure you write that tests the
  7253.             values of the tip position and the balloon rectangle calculated by
  7254.             the Help Manager. You would write such a procedure if you 
  7255.             anticipated problems positioning a help balloon.  Using this
  7256.             function gives the application one more chance to modify the 
  7257.             balloon’s position or the dimensions of the balloon before 
  7258.             displaying it. Pass NIL for the tipProc parameter if you want the 
  7259.             Help Manager to ignore the HMBaloonHook function. For additional
  7260.             information, see “Changing the Tip Position and the Dimensions of
  7261.             the Help Balloon” earlier in this chapter for additional
  7262.             information.
  7263.  
  7264. reserved    specify 0.
  7265.  
  7266. reserved    specify 0.
  7267.  
  7268. Result codes
  7269. noErr                      0  No error
  7270. paramErr                 –50  Bad parameters passed in message record
  7271. memFullErr              –108  Not enough room in heap zone
  7272. resNotFound             –192  'hmnu' resource could not be read
  7273. hmHelpDisabled          –850  Balloon help is disabled
  7274. hmCouldnotLoadPackage   –860  There was not enough memory to load
  7275.        package
  7276. hmOperationUnsupported  –861  Could not interpret call
  7277.  
  7278. æKY HMMouseInApplRgn
  7279. æFp Balloons.p
  7280. æT FUNCTION
  7281. æD FUNCTION HMMouseInApplRgn: BOOLEAN;
  7282.     INLINE $303C,$0006,_Pack14;
  7283. æDT myVariable := HMMouseInApplRgn(paramList);
  7284. æC 
  7285.  
  7286. æKY HMIsBalloon
  7287. æFp Balloons.p
  7288. æT FUNCTION
  7289. æD FUNCTION HMIsBalloon: BOOLEAN;
  7290.     INLINE $303C,$0007,_Pack14;
  7291. æDT myVariable := HMIsBalloon(paramList);
  7292. æC 
  7293. The HMIsBalloon function determines whether a help balloon is currently showing.
  7294. A return value of TRUE means that a balloon is showing; a value of FALSE means
  7295. that no balloon is showing.
  7296.  
  7297. æKY HMSetFont
  7298. æFp Balloons.p
  7299. æT FUNCTION
  7300. æD FUNCTION HMSetFont(font: INTEGER): INTEGER;
  7301.     INLINE $303C,$0108,_Pack14;
  7302. æDT myVariable := HMSetFont(font);
  7303. æC 
  7304.  
  7305. æKY HMSetFontSize
  7306. æFp Balloons.p
  7307. æT FUNCTION
  7308. æD FUNCTION HMSetFontSize(fontsize: INTEGER): INTEGER;
  7309.     INLINE $303C,$0109,_Pack14;
  7310. æDT myVariable := HMSetFontSize(fontsize);
  7311. æC 
  7312.  
  7313. æKY HMGetFont
  7314. æFp Balloons.p
  7315. æT FUNCTION
  7316. æD FUNCTION HMGetFont(VAR font: INTEGER): INTEGER;
  7317.     INLINE $303C,$020A,_Pack14;
  7318. æDT myVariable := HMGetFont(font);
  7319. æC 
  7320.  
  7321. æKY HMGetFontSize
  7322. æFp Balloons.p
  7323. æT FUNCTION
  7324. æD FUNCTION HMGetFontSize(VAR fontSize: INTEGER): INTEGER;
  7325.     INLINE $303C,$020B,_Pack14;
  7326. æDT myVariable := HMGetFontSize(fontSize);
  7327. æC 
  7328.  
  7329. æKY HMSetDialogResID
  7330. æFp Balloons.p
  7331. æT FUNCTION
  7332. æD FUNCTION HMSetDialogResID(resID: INTEGER): INTEGER;
  7333.     INLINE $303C,$010C,_Pack14;
  7334. æDT myVariable := HMSetDialogResID(resID);
  7335. æC 
  7336.  
  7337. æKY HMSetMenuResID
  7338. æFp Balloons.p
  7339. æT FUNCTION
  7340. æD FUNCTION HMSetMenuResID(menuID: INTEGER;resID: INTEGER): INTEGER;
  7341.     INLINE $303C,$020D,_Pack14;
  7342. æDT myVariable := HMSetMenuResID(menuID,resID);
  7343. æC 
  7344.  
  7345. æKY HMBalloonRect
  7346. æFp Balloons.p
  7347. æT FUNCTION
  7348. æD FUNCTION HMBalloonRect(aHelpMsg: struct HMMessageRecord;VAR coolRect: Rect): INTEGER;
  7349.     INLINE $303C,$040E,_Pack14;
  7350. æDT myVariable := HMBalloonRect(aHelpMsg,coolRect);
  7351. æC 
  7352. The HMBalloonRect procedure calculates the dimensions of a balloon containing a
  7353. specified message. You can use the results of this procedure to provide the
  7354. dimensions of a customized balloon that you define yourself.
  7355.  
  7356. The HMBalloonRect function returns a rectangle in the coolRect parameter that is
  7357. just the right size to display the text message specified by the aHelpMessage
  7358. parameter.
  7359.  
  7360. See “Providing Help for Application-Specific Elements” earlier in this chapter
  7361. for a description of the HMMessageRecord data type.
  7362.  
  7363. Result codes
  7364. noErr                           0  No Error
  7365. paramErr                      –50  Bad parameters passed in message
  7366.  memFullErr                  –108  Not enough room in heap zone
  7367. recordhmCouldnotLoadPackage  –860  There was not enough memory to load package 
  7368.  
  7369. hmOperationUnsupported       –861  Could not interpret call
  7370.  
  7371. æKY HMBaloonPict
  7372. æFp Balloons.p
  7373. æT FUNCTION
  7374. æD FUNCTION HMBaloonPict(aHelpMsg: struct HMMessageRecord;VAR coolPict: Handle): INTEGER;
  7375.     INLINE $303C,$040F,_Pack14;
  7376. æDT myVariable := HMBaloonPict(aHelpMsg,coolPict);
  7377. æC 
  7378. The HMBalloonPict function returns a handle to a picture that shows how the text
  7379. contained in aHelpMessage is going to be displayed.
  7380.  
  7381. Result codes
  7382. noErr                      0  No Error
  7383. paramErr                 –50  Bad parameters passed in message
  7384.  memFullErr             –108  Not enough room in heap zone
  7385. hmCouldnotLoadPackage   –860  There was not enough memory to load package
  7386. hmOperationUnsupported  –861  Could not interpret call
  7387.  
  7388. æKY HMScanTemplateItems
  7389. æFp Balloons.p
  7390. æT FUNCTION
  7391. æD FUNCTION HMScanTemplateItems(whichID: INTEGER;whichResFile: INTEGER;whichType: ResType): INTEGER;
  7392.     INLINE $303C,$0410,_Pack14;
  7393. æDT myVariable := HMScanTemplateItems(whichID,whichResFile,whichType);
  7394. æC 
  7395. You use this function when you have no other way of associating a dialog box or
  7396. window with an 'hdlg' or 'hrct' resource. This might happen because you have a
  7397. dialog box with a changing title and a fixed item list or because you want to
  7398. supply help for areas of a window whose title changes.
  7399.  
  7400. When you call this function the Help Manager will provide help messages (for the
  7401. frontmost window) from the resource whose type you specify with the whichType
  7402. parameter and whose ID you specify using the which ID parameter. The resource
  7403. must reside in the file specified by the whichResFile parameter and this file
  7404. must be open.
  7405.  
  7406. The whichType parameter specifies the type of the resource and must be either
  7407. 'hdlg' or 'hrct'.
  7408.  
  7409. Result codes
  7410. noErr                      0  No error
  7411. fnOpenErr                –38  Resource file was not open
  7412. paramErr                 –50  Bad parameters passed in message record
  7413. memFullErr              –108  Not enough room in heap zone
  7414. resnotFound             –192  'hmnu' resource could not be read
  7415. hmHelpDisabled          –850  Balloon help is disabled
  7416. hmCouldnotLoadPackage   –860  There was not enough memory to load
  7417.        package
  7418. hmOperationUnsupported  –861  Could not interpret call
  7419.  
  7420.  
  7421. æKY HMExtractHelpMsg
  7422. æFp Balloons.p
  7423. æT FUNCTION
  7424. æD FUNCTION HMExtractHelpMsg(whichType: ResType;whichResID: INTEGER;whichMsg: INTEGER;
  7425.     whichState: INTEGER;VAR aHelpMsg: HMMessageRecord): INTEGER;
  7426.     INLINE $303C,$0711,_Pack14;
  7427. æDT myVariable := HMExtractHelpMsg(whichType,whichResID,whichMsg,whichState,aHelpMsg);
  7428. æC 
  7429.  
  7430. æKY HMFillCitationString
  7431. æFp Balloons.p
  7432. æT FUNCTION
  7433. æD FUNCTION HMFillCitationString(origString: StringPtr;stuffString: StringPtr;
  7434.     key: INTEGER): INTEGER;
  7435.     INLINE $303C,$0512,_Pack14;
  7436. æDT myVariable := HMFillCitationString(origString,stuffString,key);
  7437. æC 
  7438.  
  7439. æKY HMGetDialogResID
  7440. æFp Balloons.p
  7441. æT FUNCTION
  7442. æD FUNCTION HMGetDialogResID(VAR resID: INTEGER): INTEGER;
  7443.     INLINE $303C,$0213,_Pack14;
  7444. æDT myVariable := HMGetDialogResID(resID);
  7445. æC 
  7446. The following routines allow you to override the 'hdlg' or 'hmnu' resources that
  7447. the Help Manager currently associates with your menus and dialog boxes.
  7448.  
  7449. FUNCTION HMGetDialogResID (VAR resID : Integer) : OSErr;
  7450.  
  7451. The HMGetDialogResID function returns the 'hdlg' resource ID that the Help
  7452. Manager is currently using to provide help messages for a dialog box. If there
  7453. is no current resource, resID contains -1.
  7454.  
  7455. Result codes
  7456. noErr                      0  No error
  7457. memFullErr              –108  Not enough room in the heap zone
  7458. resNotFound             –192  'hdlg' resource could not be read  
  7459. hmCouldnotLoadPackage   –860  There was not enough memory to load package
  7460. hmOperationUnsupported  –861  Could not interpret call
  7461.  
  7462. FUNCTION HMSetDialogResID (resID: Integer) : OSErr;
  7463.  
  7464. You can use the HMSetDialogResID function in two ways:
  7465.  
  7466. 1.  If a dialog or alert item list  ('DITL') does not include a helpItem
  7467.     specifying an 'hdlg' ID that the Help Manager should use to display
  7468.     help messages, calling the HMSetDialogResID function just before 
  7469.     displaying the dialog or alert box tells the Help Manager to display help
  7470.     messages stored in the 'hdlg' resource whose ID is specified by resID.
  7471.  
  7472. 2.  If a dialog or alert item list does include a helpItem, you call the
  7473.     HMSetDialogResID function just before displaying the dialog or alert box
  7474.     to override the 'hdlg' ID resource specified in the helpItem field. 
  7475.     Call the HMSetDialogResID function with a resID value of -1 after displaying
  7476.     the alert or dialog box to clear (reset) the first call.
  7477.  
  7478. Result codes
  7479. noErr                      0  No error
  7480. memFullErr              –108  Not enough room in the heap zone
  7481. resNotFound             –192  'hdlg' resource could not be read  
  7482. hmCouldnotLoadPackage   –860  There was not enough memory to load pacage
  7483. hmOperationUnsupported  –861  Could not interpret call
  7484.  
  7485. æKY HMGetMenuResID
  7486. æFp Balloons.p
  7487. æT FUNCTION
  7488. æD FUNCTION HMGetMenuResID(menuID: INTEGER;VAR resID: INTEGER): INTEGER;
  7489.     INLINE $303C,$0314,_Pack14;
  7490. æDT myVariable := HMGetMenuResID(menuID,resID);
  7491. æC 
  7492. The HMSetMenuResID function overrides the ‘hmnu’ resource ID used to provide
  7493. help text for a particular menu.
  7494.  
  7495. The menuID parameter specifies an existing menu ID in the application’s menu
  7496. list.  The resID parameter specifies a ‘hmnu’ resource ID that is to be used in
  7497. place of the ‘hmnu’ resource normally used to provide help for the specified
  7498. menu.
  7499.  
  7500. If the menuID is not in the menu list, the function does nothing.
  7501.  
  7502. To dissociate the menu specified by menuID from the resource specified by resID,
  7503. specify -1 for the resID parameter.
  7504.  
  7505. Result codes
  7506. noErr                      0  No error
  7507. memFullErr              –108  Not enough room in the heap zone
  7508. resNotFound             –192  'hdlg' resource could not be read  
  7509. hmCouldnotLoadPackage   –860  There was not enough memory to load package
  7510. hmOperationUnsupported  –861  Could not interpret call
  7511.  
  7512.  
  7513. æKY Controls.p
  7514. æKL DisposeControl
  7515. DragControl
  7516. Draw1Control
  7517. DrawControls
  7518. FindControl
  7519. GetAuxCtl
  7520. GetCRefCon
  7521. GetCTitle
  7522. GetCtlAction
  7523. GetCtlMax
  7524. GetCtlMin
  7525. GetCtlValue
  7526. GetCVariant
  7527. GetNewControl
  7528. HideControl
  7529. HiliteControl
  7530. KillControls
  7531. MoveControl
  7532. NewControl
  7533. SetCRefCon
  7534. SetCTitle
  7535. SetCtlAction
  7536. SetCtlColor
  7537. SetCtlMax
  7538. SetCtlMin
  7539. SetCtlValue
  7540. ShowControl
  7541. SizeControl
  7542. TestControl
  7543. TrackControl
  7544. UpdtControl
  7545.  
  7546. autoTrack
  7547. AuxCtlHandle
  7548. AuxCtlPtr
  7549. AuxCtlRec
  7550. calcCntlRgn
  7551. calcCRgns
  7552. calcThumbRgn
  7553. cBodyColor
  7554. CCTabHandle
  7555. CCTabPtr
  7556. cFrameColor
  7557. checkBoxProc
  7558. ControlHandle
  7559. ControlPtr
  7560. ControlRecord
  7561. cTextColor
  7562. cThumbColor
  7563. CtlCTab
  7564. dispCntl
  7565. dragCntl
  7566. drawCntl
  7567. hAxisOnly
  7568. inButton
  7569. inCheckBox
  7570. inDownButton
  7571. initCntl
  7572. inLabel
  7573. inMenu
  7574. inPageDown
  7575. inPageUp
  7576. inThumb
  7577. inTriangle
  7578. inUpButton
  7579. noConstraint
  7580. popupMenuProc
  7581. popupTitleCenterJust
  7582. popupTitleLeftJust
  7583. popupTitleRightJust
  7584. posCntl
  7585. pushButProc
  7586. radioButProc
  7587. scrollBarProc
  7588. testCntl
  7589. thumbCntl
  7590. useWFont
  7591. vAxisOnly
  7592.  
  7593. æKY pushButProc
  7594. æFp Controls.p
  7595. æT CONST
  7596. æD pushButProc = 0;
  7597. æC 
  7598.  
  7599. æKY checkBoxProc
  7600. æFp Controls.p
  7601. æT CONST
  7602. æD checkBoxProc = 1;
  7603. æC 
  7604.  
  7605. æKY radioButProc
  7606. æFp Controls.p
  7607. æT CONST
  7608. æD radioButProc = 2;
  7609. æC 
  7610.  
  7611. æKY useWFont
  7612. æFp Controls.p
  7613. æT CONST
  7614. æD useWFont = 8;
  7615. æC 
  7616.  
  7617. æKY scrollBarProc
  7618. æFp Controls.p
  7619. æT CONST
  7620. æD scrollBarProc = 16;
  7621. æC 
  7622.  
  7623. æKY inButton
  7624. æFp Controls.p
  7625. æT CONST
  7626. æD inButton = 10;
  7627. æC 
  7628.  
  7629. æKY inCheckBox
  7630. æFp Controls.p
  7631. æT CONST
  7632. æD inCheckBox = 11;
  7633. æC 
  7634.  
  7635. æKY inUpButton
  7636. æFp Controls.p
  7637. æT CONST
  7638. æD inUpButton = 20;
  7639. æC 
  7640.  
  7641. æKY inDownButton
  7642. æFp Controls.p
  7643. æT CONST
  7644. æD inDownButton = 21;
  7645. æC 
  7646.  
  7647. æKY inPageUp
  7648. æFp Controls.p
  7649. æT CONST
  7650. æD inPageUp = 22;
  7651. æC 
  7652.  
  7653. æKY inPageDown
  7654. æFp Controls.p
  7655. æT CONST
  7656. æD inPageDown = 23;
  7657. æC 
  7658.  
  7659. æKY inThumb
  7660. æFp Controls.p
  7661. æT CONST
  7662. æD inThumb = 129;
  7663. æC 
  7664.  
  7665. æKY popupMenuProc
  7666. æFp Controls.p
  7667. æT CONST
  7668. æD popupMenuProc = 1008; { 63 * 16 }
  7669. æC 
  7670.  
  7671. æKY inLabel
  7672. æFp Controls.p
  7673. æT CONST
  7674. æD inLabel = 1;
  7675. æC 
  7676.  
  7677. æKY inMenu
  7678. æFp Controls.p
  7679. æT CONST
  7680. æD inMenu = 2;
  7681. æC 
  7682.  
  7683. æKY inTriangle
  7684. æFp Controls.p
  7685. æT CONST
  7686. æD inTriangle = 4;
  7687. æC 
  7688.  
  7689. æKY popupTitleLeftJust
  7690. æFp Controls.p
  7691. æT CONST
  7692. æD popupTitleLeftJust = $0000;
  7693. æC 
  7694.  
  7695. æKY popupTitleCenterJust
  7696. æFp Controls.p
  7697. æT CONST
  7698. æD popupTitleCenterJust = $0001;
  7699. æC 
  7700.  
  7701. æKY popupTitleRightJust
  7702. æFp Controls.p
  7703. æT CONST
  7704. æD popupTitleRightJust = $00FF;
  7705. æC 
  7706.  
  7707. æKY noConstraint
  7708. æFp Controls.p
  7709. æT CONST
  7710. æD 
  7711. axis constraints for DragGrayRgn call }
  7712.  
  7713. noConstraint = 0;
  7714. æC 
  7715.  
  7716. æKY hAxisOnly
  7717. æFp Controls.p
  7718. æT CONST
  7719. æD hAxisOnly = 1;
  7720. æC 
  7721.  
  7722. æKY vAxisOnly
  7723. æFp Controls.p
  7724. æT CONST
  7725. æD vAxisOnly = 2;
  7726. æC 
  7727.  
  7728. æKY drawCntl
  7729. æFp Controls.p
  7730. æT CONST
  7731. æD 
  7732. control messages }
  7733.  
  7734. drawCntl = 0;
  7735. æC 
  7736.  
  7737. æKY testCntl
  7738. æFp Controls.p
  7739. æT CONST
  7740. æD testCntl = 1;
  7741. æC 
  7742.  
  7743. æKY calcCRgns
  7744. æFp Controls.p
  7745. æT CONST
  7746. æD calcCRgns = 2;
  7747. æC 
  7748.  
  7749. æKY initCntl
  7750. æFp Controls.p
  7751. æT CONST
  7752. æD initCntl = 3;
  7753. æC 
  7754.  
  7755. æKY dispCntl
  7756. æFp Controls.p
  7757. æT CONST
  7758. æD dispCntl = 4;
  7759. æC 
  7760.  
  7761. æKY posCntl
  7762. æFp Controls.p
  7763. æT CONST
  7764. æD posCntl = 5;
  7765. æC 
  7766.  
  7767. æKY thumbCntl
  7768. æFp Controls.p
  7769. æT CONST
  7770. æD thumbCntl = 6;
  7771. æC 
  7772.  
  7773. æKY dragCntl
  7774. æFp Controls.p
  7775. æT CONST
  7776. æD dragCntl = 7;
  7777. æC 
  7778.  
  7779. æKY autoTrack
  7780. æFp Controls.p
  7781. æT CONST
  7782. æD autoTrack = 8;
  7783. æC 
  7784.  
  7785. æKY cFrameColor
  7786. æFp Controls.p
  7787. æT CONST
  7788. æD cFrameColor = 0;
  7789. æC 
  7790.  
  7791. æKY cBodyColor
  7792. æFp Controls.p
  7793. æT CONST
  7794. æD cBodyColor = 1;
  7795. æC 
  7796.  
  7797. æKY cTextColor
  7798. æFp Controls.p
  7799. æT CONST
  7800. æD cTextColor = 2;
  7801. æC 
  7802.  
  7803. æKY cThumbColor
  7804. æFp Controls.p
  7805. æT CONST
  7806. æD cThumbColor = 3;
  7807. æC 
  7808.  
  7809. æKY calcCntlRgn
  7810. æFp Controls.p
  7811. æT CONST
  7812. æD calcCntlRgn = 10;
  7813. æC 
  7814.  
  7815. æKY calcThumbRgn
  7816. æFp Controls.p
  7817. æT CONST
  7818. æD calcThumbRgn = 11;
  7819. æC 
  7820.  
  7821. æKY ControlRecord
  7822. ControlPtr
  7823. ControlHandle
  7824. æFp Controls.p
  7825. æT RECORD
  7826. æD ControlPtr = ^ControlRecord;
  7827. ControlHandle = ^ControlPtr;
  7828. ControlRecord = PACKED RECORD
  7829.     nextControl: ControlHandle;
  7830.     contrlOwner: WindowPtr;
  7831.     contrlRect: Rect;
  7832.     contrlVis: Byte;
  7833.     contrlHilite: Byte;
  7834.     contrlValue: INTEGER;
  7835.     contrlMin: INTEGER;
  7836.     contrlMax: INTEGER;
  7837.     contrlDefProc: Handle;
  7838.     contrlData: Handle;
  7839.     contrlAction: ProcPtr;
  7840.     contrlRfCon: LONGINT;
  7841.     contrlTitle: Str255;
  7842.     END;
  7843. æC 
  7844. Every control is represented internally by a control record containing all pertinent
  7845. information about that control. The control record contains the following:
  7846.  
  7847.   •  A pointer to the window the control belongs to.
  7848.   •  A handle to the next control in the window’s control list.
  7849.   •  A handle to the control definition function.
  7850.   •  The control’s title, if any.
  7851.   •  A rectangle that completely encloses the control, which determines
  7852.      the control’s size and location within its window. The entire control,
  7853.      including the title of a check box or radio button, is drawn inside
  7854.      this rectangle.
  7855.   •  An indication of whether the control is currently active and how it’s
  7856.      to be highlighted.
  7857.   •  The current setting of the control (if this type of control retains a
  7858.      setting) and the minimum and maximum values the setting can assume. For
  7859.      check boxes and radio buttons, a setting of 0 means the control is off
  7860.      and 1 means it’s on.
  7861.  
  7862. The control record also contains an indication of whether the control is currently
  7863. visible or invisible. These terms refer only to whether the control is drawn in its
  7864. window, not to whether you can see it on the screen. A control may be “visible” and
  7865. still not appear on the screen, because it’s obscured by overlapping windows or other
  7866. objects.
  7867.  
  7868. There’s a field in the control record for a pointer to the control’s default action
  7869. procedure. An action procedure defines some action to be performed repeatedly for as
  7870. long as the user holds down the mouse button inside the control. The default action
  7871. procedure may be used by the Control Manager function TrackControl if you call it
  7872. without passing a pointer to an action procedure; this is discussed in detail in the
  7873. description of TrackControl in the “Control Manager Routines” section.
  7874.  
  7875. Finally, the control record includes a 32-bit reference value field, which is reserved
  7876. for use by your application. You specify an initial reference value when you create a
  7877. control, and can then read or change the reference value whenever you wish.
  7878.  
  7879. The data type for a control record is called ControlRecord. A control record is
  7880. referred to by a handle:
  7881.  
  7882. TYPE  ControlPtr     = ^ControlRecord;
  7883.       ControlHandle  = ^ControlPtr;
  7884.  
  7885. The Control Manager functions for creating a control return a handle to a newly
  7886. allocated control record; thereafter, your program should normally refer to the
  7887. control by this handle. Most of the Control Manager routines expect a control handle
  7888. as their first parameter.
  7889.  
  7890. You can store into and access most of a control record’s fields with Control Manager
  7891. routines, so normally you don’t have to know the exact field names. However, if you
  7892. want more information about the exact structure of a control record—if you’re defining
  7893. your own control types, for instance—it’s given below.
  7894.  
  7895. _______________________________________________________________________________
  7896.  
  7897. »The ControlRecord Data Type
  7898.  
  7899. The ControlRecord data type is defined as follows:
  7900.  
  7901. TYPE ControlRecord =
  7902.       PACKED RECORD
  7903.         nextControl:    ControlHandle;  {next control}
  7904.         contrlOwner:    WindowPtr;      {control's window}
  7905.         contrlRect:     Rect;           {enclosing rectangle}
  7906.         contrlVis:      Byte;           {255 if visible}
  7907.         contrlHilite:   Byte;           {highlight state}
  7908.         contrlValue:    INTEGER;        {control's current setting}
  7909.         contrlMin:      INTEGER;        {control's minimum setting}
  7910.         contrlMax:      INTEGER;        {control's maximum setting}
  7911.         contrlDefProc:  Handle;         {control definition function}
  7912.         contrlData:     Handle;         {data used by contrlDefProc}
  7913.         contrlAction:   ProcPtr;        {default action procedure}
  7914.         contrlRfCon:    LONGINT;        {control's reference value}
  7915.         contrlTitle:    Str255          {control's title}
  7916.       END;
  7917.  
  7918. NextControl is a handle to the next control associated with this control’s window.
  7919. All the controls belonging to a given window are kept in a linked list, beginning in
  7920. the controlList field of the window record and chained together through the nextControl
  7921. fields of the individual control records. The end of the list is marked by a NIL
  7922. value; as new controls are created, they’re added to the beginning of the list.
  7923.  
  7924. ContrlOwner is a pointer to the window that this control belongs to.
  7925.  
  7926. ContrlRect is the rectangle that completely encloses the control, in the local coordinates
  7927. of the control’s window.
  7928.  
  7929. When contrlVis is 0, the control is currently invisible; when it’s 255, the control
  7930. is visible.
  7931.  
  7932. ContrlHilite specifies whether and how the control is to be highlighted, indicating
  7933. whether it’s active or inactive. The HiliteControl procedure lets you set this field;
  7934. see the description of HiliteControl for more information about the meaning of the
  7935. field’s value.
  7936.  
  7937. ContrlValue is the control’s current setting. For check boxes and radio buttons, 0
  7938. means the control is off and 1 means it’s on. For dials, the fields contrlMin and
  7939. contrlMax define the range of possible settings; contrlValue may take on any value
  7940. within that range. Other (custom) control types can use these three fields as they
  7941. see fit.
  7942.  
  7943. ContrlDefProc is a handle to the control definition function for this type of control.
  7944. When you create a control, you identify its type with a control definition ID, which
  7945. is converted into a handle to the control definition function and stored in the
  7946. contrlDefProc field. Thereafter, the Control Manager uses this handle to access the
  7947. definition function; you should never need to refer to this field directly.
  7948.  
  7949. Note:  When not running in 32-bit mode, the high-order byte of the
  7950.        contrlDefProc field contains some additional information that
  7951.        the Control Manager gets from the control definition ID; for
  7952.        details, see the section “Defining Your Own Controls”.
  7953.  
  7954. ContrlData is reserved for use by the control definition function, typically to hold
  7955. additional information specific to a particular control type. For example, the standard
  7956. definition function for scroll bars uses this field for a handle to the region containing
  7957. the scroll bar’s thumb. If no more than four bytes of additional information are
  7958. needed, the definition function can store the information directly in the contrlData
  7959. field rather than use a handle.
  7960.  
  7961. ContrlAction is a pointer to the control’s default action procedure, if any. The
  7962. Control Manager function TrackControl may call this procedure to respond to the
  7963. user’s dragging the mouse inside the control.
  7964.  
  7965. ContrlRfCon is the control’s reference value field, which the application may store
  7966. into and access for any purpose.
  7967.  
  7968. ContrlTitle is the control’s title, if any.
  7969.  
  7970. æKY CtlCTab
  7971. CCTabPtr
  7972. CCTabHandle
  7973. æFp Controls.p
  7974. æT RECORD
  7975. æD CCTabPtr = ^CtlCTab;
  7976. CCTabHandle = ^CCTabPtr;
  7977. CtlCTab = RECORD
  7978.     ccSeed: LONGINT; {reserved}
  7979.     ccRider: INTEGER; {see what you have done - reserved}
  7980.     ctSize: INTEGER; {usually 3 for controls}
  7981.     ctTable: ARRAY [0..3] OF ColorSpec;
  7982.     END;
  7983. æC 
  7984. The contents and meaning of a control’s color table are determined by its control
  7985. definition function (see “The Control Color Table Resource” section). The CTabHandle
  7986. parameter used in the Color Control Manager routines provides a handle to the control
  7987. color table. The components of a control color table are defined as follows:
  7988.  
  7989. TYPE
  7990.   CCTabHandle = ^CCTabPtr;
  7991.   CCTabPtr    = ^CtlCTab;
  7992.   CtlCTab     = RECORD
  7993.                   ccSeed:      LONGINT;    {not used for controls}
  7994.                   ccRider:     INTEGER;    {not used for controls}
  7995.                   ctSize:      INTEGER;    {number of entries in table –1}
  7996.                   ctTable:     cSpecArray  {array of ColorSpec records}
  7997.                 END;
  7998.  
  7999. Field descriptions
  8000.  
  8001. ccSeed        The ccSeed field is unused in control color tables.
  8002.  
  8003. ccRider       The ccRider field is unused in control color tables.
  8004.  
  8005. ctSize        The ctSize field defines the number of elements in the table,
  8006.               minus one. For controls drawn with the standard definition
  8007.               procedure, this field is always 3.
  8008.  
  8009. ctTable       The ctTable field holds an array of colorSpec records. Each
  8010.               colorSpec is made up of a partIdentifier field and a partRGB
  8011.               field. The partIdentifier field holds an integer which
  8012.               associates an RGBColor to a particular part of the control.
  8013.               The definition procedures attempt to find the appropriate part
  8014.               identifier when preparing to draw a part. If that part
  8015.               identifier is not found, the first color in the table is
  8016.               used to draw the part. The part identifiers can appear in any
  8017.               order in the table. The partRGB field specifies a standard RGB
  8018.               color record, indicating what absolute color will be used to
  8019.               draw the control part found in the partIdentifier field.
  8020.  
  8021. A standard control color table is shown in Figure 6.
  8022.  
  8023. •••Refer to Figure 6.•••
  8024.  
  8025. Figure 6–Control Color Table
  8026.  
  8027. The 'cctb' resource is an exact image of this control table data structure, and is
  8028. stored in the same format as 'clut' color table resources.
  8029.  
  8030. Standard buttons, check boxes, and radio buttons use a four-element color table with
  8031. part identifiers as shown below:
  8032.  
  8033.   cFrameColor (0)       Frame color
  8034.   cBodyColor (1)        Fill color for body of control
  8035.   cTextColor (2)        Text color
  8036.   cThumbColor (3)       Unused
  8037.  
  8038. When highlighted, plain buttons exchange their body and text colors (colors 1 and 2);
  8039. check boxes and radio buttons change their appearance without changing colors.  All
  8040. three types indicate deactivation by dimming their text with no change in colors.
  8041.  
  8042. Standard scroll bars use a four-element color table with part identifiers as shown
  8043. below:
  8044.  
  8045.   cFrameColor (0)       Frame color, foreground color for shaft and arrows
  8046.   cBodyColor (1         Background color for shaft and arrows
  8047.   cTextColor (2)        Unused
  8048.   cThumbColor (3)       Fill color for thumb
  8049.  
  8050. When highlighted, the arrows are filled with the foreground color (color 0) within
  8051. the arrow outline. A deactivated scroll bar shows no indicator, and displays its
  8052. shaft in solid background color (color 1), with no pattern.
  8053.  
  8054. The 'cctb' resource = 0 is read into the application heap when the application starts,
  8055. and serves as the default control color table. The last record in the auxiliary
  8056. control list points to the default 'cctb' resource. When drawing a control, the
  8057. standard control definition function searches the list for an auxiliary control
  8058. record whose acOwner points to the control being drawn.  If it finds such a record,
  8059. it uses the color table designated by that record; if it doesn’t find one before
  8060. reaching the default record at the end of the list, it uses the default color table
  8061. instead. All types of controls share the same default record. The default auxiliary
  8062. control record is recognized by NIL values in both its acNext and acOwner fields; the
  8063. application must not change these fields.
  8064.  
  8065. A nonstandard control definition function can use color tables of any desired size
  8066. and define their contents in any way it wishes, except that part indices 1 to 127 are
  8067. reserved for system definition.  Any such nonstandard function should take care to
  8068. bypass the defaulting mechanism just described, by allocating an explicit auxiliary
  8069. record for every control it creates.
  8070.  
  8071. æKY AuxCtlRec
  8072. AuxCtlPtr
  8073. AuxCtlHandle
  8074. æFp Controls.p
  8075. æT RECORD
  8076. æD AuxCtlPtr = ^AuxCtlRec;
  8077. AuxCtlHandle = ^AuxCtlPtr;
  8078. AuxCtlRec = RECORD
  8079.     acNext: AuxCtlHandle; {handle to next AuxCtlRec}
  8080.     acOwner: ControlHandle; {handle for aux record's control}
  8081.     acCTable: CCTabHandle; {color table for this control}
  8082.     acFlags: INTEGER; {misc flag byte}
  8083.     acReserved: LONGINT; {reserved for use by Apple}
  8084.     acRefCon: LONGINT; {for use by application}
  8085.     END;
  8086. æC 
  8087. The information needed for drawing controls in color is kept in a linked list of
  8088. auxiliary control records, beginning in the global variable AuxCtlHead.
  8089. (Notice that there is just one global list for all controls in all windows, not a
  8090. separate one for each window.) Each window record has a handle to the list of controls.
  8091. Figure 5 shows the auxiliary control list structure.
  8092.  
  8093. •••Refer to Figure 5.•••
  8094.  
  8095. Figure 5–Auxiliary Control List
  8096.  
  8097. Each auxiliary control record is a relocatable object residing in the application
  8098. heap. The most important information it holds is a handle to the control’s individual
  8099. color table (see the “Control Color Tables” section).  The rest of the record consists
  8100. of a link to the next record in the list, a field that identifies the control’s
  8101. owner, a 4-byte field reserved for future expansion, and a 4-byte reference constant
  8102. for use by the application:
  8103.  
  8104. TYPE
  8105.   AuxCtlHandle = ^AuxCtlPtr;
  8106.   AuxCtlPtr    = ^AuxCtlRec;
  8107.   AuxCtlRec    = RECORD
  8108.                    acNext:      AuxCtlHandle;   {handle to next record in list}
  8109.                    acOwner:     ControlHandle;  {handle to owning control}
  8110.                    acCTable:    CCTabHandle;    {handle to control's color }
  8111.                                                 { table}
  8112.                    acFlags:     INTEGER;        {miscellaneous flags; reserved}
  8113.                    acReserved:  LONGINT;        {reserved for future expansion}
  8114.                    acRefCon:    LONGINT         {reserved for application use}
  8115.                  END;
  8116.  
  8117. Field descriptions
  8118.  
  8119. acNext        The acNext field contains a handle to the next record in
  8120.               the auxiliary control list.
  8121.  
  8122. acOwner       The acOwner field contains the handle of the control to
  8123.               which this auxiliary record belongs. Used as an ID field.
  8124.  
  8125. acCTable      The acCTable contains the handle to the control’s color
  8126.               table (see “Control Color Tables” below).
  8127.  
  8128. acFlags       The acFlags field contains miscellaneous flags for use by
  8129.               the Control Manager; this field is reserved.
  8130.  
  8131. acReserved    The acReserved field is reserved for future expansion;
  8132.               this must be set to 0 for future compatibility.
  8133.  
  8134. acRefCon      The acRefCon field is a reference constant for use by
  8135.               the application.
  8136.  
  8137. Not every control needs an auxiliary control record.  When an application is started,
  8138. a resource containing a default color table is loaded from the system resource file;
  8139. this resource defines a standard set of control colors. Since there is no InitControls
  8140. routine, this happens when an application calls InitWindows.
  8141.  
  8142. Separate auxiliary control records are needed only for controls whose color usage
  8143. differs from the default.  Each such nonstandard control must have its own auxiliary
  8144. record, even if it uses the same colors as another control. This allows two or more
  8145. auxiliary records to share the same control color table. If the control color table
  8146. is a resource, it won’t be deleted by DisposeControl. When using an auxiliary record
  8147. that is not stored as a resource, the application should not deallocate the color
  8148. table if another control is still using it.
  8149.  
  8150. A control created from scratch will initially have no auxiliary control record.  If
  8151. it is to use nonstandard colors, it must be given an auxiliary record and a color
  8152. table with SetCtlColor (see the “Control Manager Routines” section).  Such a control
  8153. should normally be made invisible at creation and then displayed with ShowControl
  8154. after the colors are set.  For controls created from a 'CNTL' resource,  the color
  8155. table can be specified as a resource as well. See the section titled “The Control
  8156. Color Table Resource”.
  8157.  
  8158. A/UX systems:  When using 32-bit mode. every control has its own auxiliary
  8159.                record. If there is no specific set of control colors for
  8160.                this control, the acCTable will point to the default color table.
  8161.  
  8162. æKY NewControl
  8163. æFp Controls.p
  8164. æT FUNCTION
  8165. æTN A954
  8166. æD FUNCTION NewControl(theWindow: WindowPtr;boundsRect: Rect;title: Str255;
  8167.     visible: BOOLEAN;value: INTEGER;min: INTEGER;max: INTEGER;procID: INTEGER;
  8168.     refCon: LONGINT): ControlHandle;
  8169.     INLINE $A954;
  8170. æDT myVariable := NewControl(theWindow,boundsRect,title,visible,value,min,max,procID,refCon);
  8171. æMM
  8172. æRI I-319, P-112, 114, 177
  8173. æC  
  8174. NewControl creates a control, adds it to the beginning of theWindow’s control list,
  8175. and returns a handle to the new control. The values passed as parameters are stored
  8176. in the corresponding fields of the control record, as described below. The field that
  8177. determines highlighting is set to 0 (no highlighting) and the pointer to the default
  8178. action procedure is set to NIL (none).
  8179.  
  8180. Note:  The control definition function may do additional initialization,
  8181.        including changing any of the fields of the control record. The only
  8182.        standard control for which additional initialization is done is the
  8183.        scroll bar; its control definition function allocates space for a
  8184.        region to hold the thumb and stores the region handle in the
  8185.        contrlData field of the control record.
  8186.  
  8187. TheWindow is the window the new control will belong to. All coordinates pertaining to
  8188. the control will be interpreted in this window’s local coordinate system.
  8189.  
  8190. BoundsRect, given in theWindow’s local coordinates, is the rectangle that encloses
  8191. the control and thus determines its size and location. Note the following about the
  8192. enclosing rectangle for the standard controls:
  8193.  
  8194.   •  Simple buttons are drawn to fit the rectangle exactly. (The control
  8195.      definition function calls the QuickDraw procedure FrameRoundRect.) To
  8196.      allow for the tallest characters in the system font, there should be
  8197.      at least a 20-point difference between the top and bottom coordinates
  8198.      of the rectangle.
  8199.   •  For check boxes and radio buttons, there should be at least a 16-point
  8200.      difference between the top and bottom coordinates.
  8201.   •  By convention, scroll bars are 16 pixels wide, so there should be a
  8202.      16-point difference between the left and right (or top and bottom)
  8203.      coordinates. (If there isn’t, the scroll bar will be scaled to fit
  8204.      the rectangle.) A standard scroll bar should be at least 48 pixels
  8205.      long, to allow room for the scroll arrows and thumb.
  8206.  
  8207. Title is the control’s title, if any (if none, you can just pass the empty string as
  8208. the title). Be sure the title will fit in the control’s enclosing rectangle; if it
  8209. won’t it will be truncated on the right for check boxes and radio buttons, or centered
  8210. and truncated on both ends for simple buttons.
  8211.  
  8212. Note:  Some non-Roman systems write text from right-to-left, in which
  8213.        case radio buttons and check boxes are drawn with their titles
  8214.        on the left of the control.  They are also truncated on the left.
  8215.        See the Script Manager chapter for more information.
  8216.  
  8217. If the visible parameter is TRUE, NewControl draws the control.
  8218.  
  8219. Note:  It does not use the standard window updating mechanism, but
  8220.        instead draws the control immediately in the window.
  8221.  
  8222. The min and max parameters define the control’s range of possible settings; the value
  8223. parameter gives the initial setting. For controls that don’t retain a setting, such
  8224. as buttons, the values you supply for these parameters will be stored in the control
  8225. record but will never be used. So it doesn’t matter what values you give for those
  8226. controls—0 for all three parameters will do. For controls that just retain an on-or-off
  8227. setting, such as check boxes or radio buttons, min should be 0 (meaning the control
  8228. is off) and max should be 1
  8229. (meaning it’s on). For dials, you can specify whatever values are appropriate for
  8230. min, max, and value.
  8231.  
  8232. ProcID is the control definition ID, which leads to the control definition function
  8233. for this type of control. (The function is read into memory if it
  8234. isn’t already in memory.) The control definition IDs for the standard control types
  8235. are listed above under “Controls and Resources”. Control definition IDs for custom
  8236. control types are discussed later under “Defining Your Own Controls”.
  8237.  
  8238. RefCon is the control’s reference value, set and used only by your application.
  8239.  
  8240. æKY SetCTitle
  8241. æFp Controls.p
  8242. æT PROCEDURE
  8243. æTN A95F
  8244. æD PROCEDURE SetCTitle(theControl: ControlHandle;title: Str255);
  8245.     INLINE $A95F;
  8246. æDT SetCTitle(theControl,title);
  8247. æMM
  8248. æRI I-321
  8249. æC  
  8250. SetCTitle sets theControl’s title to the given string and redraws the control.
  8251.  
  8252. æKY GetCTitle
  8253. æFp Controls.p
  8254. æT PROCEDURE
  8255. æTN A95E
  8256. æD PROCEDURE GetCTitle(theControl: ControlHandle;VAR title: Str255);
  8257.     INLINE $A95E;
  8258. æDT GetCTitle(theControl,title);
  8259. æRI I-321
  8260. æC 
  8261. GetCTitle returns theControl’s title as the value of the title parameter.
  8262.  
  8263. æKY GetNewControl
  8264. æFp Controls.p
  8265. æT FUNCTION
  8266. æTN A9BE
  8267. æD FUNCTION GetNewControl(controlID: INTEGER;owner: WindowPtr): ControlHandle;
  8268.     INLINE $A9BE;
  8269. æDT myVariable := GetNewControl(controlID,owner);
  8270. æMM
  8271. æRT 203
  8272. æRI I-321, P-112, 113, 114, 172
  8273. æC 
  8274. GetNewControl creates a control from a control template stored in a resource file,
  8275. adds it to the beginning of theWindow’s control list, and returns a handle to the new
  8276. control. ControlID is the resource ID of the template. GetNewControl works exactly
  8277. the same as NewControl (above), except that it gets the initial values for the new
  8278. control’s fields from the specified control template instead of accepting them as
  8279. parameters. If the control template can’t be read from the resource file, GetNewControl
  8280. returns NIL. It releases the memory occupied by the resource before returning.
  8281.  
  8282. The system default control colors are stored in the System file and ROMResources as
  8283. 'cctb' resource = 0. By including a 'cctb' resource = 0 in your application, it is
  8284. possible to change the default colors that will be used for all controls, unless a
  8285. specific 'cctb' exists for a control defined within the application.
  8286.  
  8287. When you use GetNewControl for the control resource 'CNTL', GetNewControl will attempt
  8288. to load a 'cctb' resource with the same ID as the 'CNTL' resource ID, if one is
  8289. present. It then executes the SetCtlColor call.
  8290.  
  8291. The following part identifiers for control elements should be present in the ColorSpec.value
  8292. field:
  8293.  
  8294.   cFrameColor (0)       Frame color
  8295.   cBodyColor (1)        Fill color for body of control
  8296.   cTextColor (2)        Text color
  8297.   cThumbColor (3)       Thumb color
  8298.  
  8299. These identifiers may be present in any order; for instance, the text or indicator
  8300. color values may be stored before the fill and frame colors in the ColorSpec record
  8301. structure. If a part identifier is not found, then the first color in the color table
  8302. will be used.
  8303.  
  8304. æKY DisposeControl
  8305. æFp Controls.p
  8306. æT PROCEDURE
  8307. æTN A955
  8308. æD PROCEDURE DisposeControl(theControl: ControlHandle);
  8309.     INLINE $A955;
  8310. æDT DisposeControl(theControl);
  8311. æMM
  8312. æRI I-321, P-168
  8313. æC 
  8314. Assembly-language note:  The macro you invoke to call DisposeControl from
  8315.                          assembly language is named _DisposControl.
  8316.  
  8317. DisposeControl removes theControl from the screen, deletes it from its window’s
  8318. control list, and releases the memory occupied by the control record and any data
  8319. structures associated with the control.
  8320.  
  8321. æKY KillControls
  8322. æFp Controls.p
  8323. æT PROCEDURE
  8324. æTN A956
  8325. æD PROCEDURE KillControls(theWindow: WindowPtr);
  8326.     INLINE $A956;
  8327. æDT KillControls(theWindow);
  8328. æMM
  8329. æRI I-321, P-113, 175
  8330. æC 
  8331. KillControls disposes of all controls associated with theWindow by calling DisposeControl
  8332. (above) for each.
  8333.  
  8334. Note:  Remember that the Window Manager procedures CloseWindow and
  8335.        DisposeWindow automatically dispose of all controls associated
  8336.        with the given window.
  8337.  
  8338. æKY HideControl
  8339. æFp Controls.p
  8340. æT PROCEDURE
  8341. æTN A958
  8342. æD PROCEDURE HideControl(theControl: ControlHandle);
  8343.     INLINE $A958;
  8344. æDT HideControl(theControl);
  8345. æMM
  8346. æRI I-322, P-113, 114, 174
  8347. æC 
  8348. HideControl makes theControl invisible. It fills the region the control occupies
  8349. within its window with the background pattern of the window’s grafPort. It also adds
  8350. the control’s enclosing rectangle to the window’s update region, so that anything
  8351. else that was previously obscured by the control will reappear on the screen. If the
  8352. control is already invisible, HideControl has no effect.
  8353.  
  8354. æKY ShowControl
  8355. æFp Controls.p
  8356. æT PROCEDURE
  8357. æTN A957
  8358. æD PROCEDURE ShowControl(theControl: ControlHandle);
  8359.     INLINE $A957;
  8360. æDT ShowControl(theControl);
  8361. æMM
  8362. æRT 197
  8363. æRI I-322, P-113, 114, 181
  8364. æC 
  8365. ShowControl makes theControl visible. The control is drawn in its window but may be
  8366. completely or partially obscured by overlapping windows or other objects. If the
  8367. control is already visible, ShowControl has no effect.
  8368.  
  8369. æKY DrawControls
  8370. æFp Controls.p
  8371. æT PROCEDURE
  8372. æTN A969
  8373. æD PROCEDURE DrawControls(theWindow: WindowPtr);
  8374.     INLINE $A969;
  8375. æDT DrawControls(theWindow);
  8376. æRT 203
  8377. æRI I-322, P-169
  8378. æC 
  8379. DrawControls draws all controls currently visible in theWindow. The controls are
  8380. drawn in reverse order of creation; thus in case of overlap the earliest-created
  8381. controls appear frontmost in the window.
  8382.  
  8383. Note:  Window Manager routines such as SelectWindow, ShowWindow, and
  8384.        BringToFront do not automatically call DrawControls to display
  8385.        the window’s controls. They just add the appropriate regions to
  8386.        the window’s update region, generating an update event. Your program
  8387.        should always call DrawControls explicitly upon receiving an update
  8388.        event for a window that contains controls.
  8389.  
  8390. æKY Draw1Control
  8391. æFp Controls.p
  8392. æT PROCEDURE
  8393. æTN A96D
  8394. æD PROCEDURE Draw1Control(theControl: ControlHandle);
  8395.     INLINE $A96D;
  8396. æDT Draw1Control(theControl);
  8397. æMM
  8398. æRI IV-53
  8399. æC 
  8400. [128K ROM]
  8401.  
  8402. Draw1Control draws the specified control if it’s visible within the window.
  8403.  
  8404. æKY HiliteControl
  8405. æFp Controls.p
  8406. æT PROCEDURE
  8407. æTN A95D
  8408. æD PROCEDURE HiliteControl(theControl: ControlHandle;hiliteState: INTEGER);
  8409.     INLINE $A95D;
  8410. æDT HiliteControl(theControl,hiliteState);
  8411. æMM
  8412. æRI I-322
  8413. æC 
  8414. HiliteControl changes the way theControl is highlighted. HiliteState has one of the
  8415. following values:
  8416.  
  8417.   •  The value 0 means no highlighting. (The control is active.)
  8418.   •  A value between 1 and 253 is interpreted as a part code designating
  8419.      the part of the (active) control to be highlighted.
  8420.   •  The value 255 means that the control is to be made inactive and
  8421.      highlighted accordingly.
  8422.  
  8423. Note:  The value 254 should not be used; this value is reserved for future use.
  8424.  
  8425. HiliteControl calls the control definition function to redraw the control with its
  8426. new highlighting.
  8427.  
  8428. æKY UpdtControl
  8429. æFp Controls.p
  8430. æT PROCEDURE
  8431. æTN A953
  8432. æD PROCEDURE UpdtControl(theWindow: WindowPtr;updateRgn: RgnHandle);
  8433.     INLINE $A953;
  8434. æDT UpdtControl(theWindow,updateRgn);
  8435. æMM
  8436. æRI IV-53
  8437. æC  
  8438. [128K ROM]
  8439.  
  8440. UpdtControl is a faster version of the DrawControls procedure. Instead of drawing all
  8441. of the controls in theWindow, UpdtControl draws only the controls that are in the
  8442. specified update region. UpdtControl is called in response to an update event, and is
  8443. usually bracketed by calls to the Window Manager procedures BeginUpdate and EndUpdate.
  8444. UpdateRgn should be set to the visRgn of theWindow’s port (for more details, see the
  8445. BeginUpdate procedure in the Window Manager chapter).
  8446.  
  8447. Note:  In general, controls are in a dialog box and are automatically
  8448.        drawn by the DrawDialog procedure.
  8449.  
  8450. æKY MoveControl
  8451. æFp Controls.p
  8452. æT PROCEDURE
  8453. æTN A959
  8454. æD PROCEDURE MoveControl(theControl: ControlHandle;h: INTEGER;v: INTEGER);
  8455.     INLINE $A959;
  8456. æDT MoveControl(theControl,h,v);
  8457. æMM
  8458. æRI I-325, P-113, 176
  8459. æC 
  8460. MoveControl moves theControl to a new location within its window. The top left corner
  8461. of the control’s enclosing rectangle is moved to the horizontal and vertical coordinates
  8462. h and v (given in the local coordinates of the control’s window); the bottom right
  8463. corner is adjusted accordingly, to keep the size of the rectangle the same as before.
  8464. If the control is currently visible, it’s hidden and then redrawn at its new location.
  8465.  
  8466. æKY SizeControl
  8467. æFp Controls.p
  8468. æT PROCEDURE
  8469. æTN A95C
  8470. æD PROCEDURE SizeControl(theControl: ControlHandle;w: INTEGER;h: INTEGER);
  8471.     INLINE $A95C;
  8472. æDT SizeControl(theControl,w,h);
  8473. æMM
  8474. æRI I-326, P-113, 181
  8475. æC 
  8476. SizeControl changes the size of theControl’s enclosing rectangle. The bottom right
  8477. corner of the rectangle is adjusted to set the rectangle’s width and height to the
  8478. number of pixels specified by w and h; the position of the top left corner is not
  8479. changed. If the control is currently visible, it’s hidden and then redrawn in its new
  8480. size.
  8481.  
  8482. æKY SetCtlValue
  8483. æFp Controls.p
  8484. æT PROCEDURE
  8485. æTN A963
  8486. æD PROCEDURE SetCtlValue(theControl: ControlHandle;theValue: INTEGER);
  8487.     INLINE $A963;
  8488. æDT SetCtlValue(theControl,theValue);
  8489. æMM
  8490. æRT 197
  8491. æRI I-326
  8492. æC 
  8493. SetCtlValue sets theControl’s current setting to theValue and redraws the control to
  8494. reflect the new setting. For check boxes and radio buttons, the value 1 fills the
  8495. control with the appropriate mark, and 0 clears it. For scroll bars, SetCtlValue
  8496. redraws the thumb where appropriate.
  8497.  
  8498. If the specified value is out of range, it’s forced to the nearest endpoint of the
  8499. current range (that is, if theValue is less than the minimum setting, SetCtlValue
  8500. sets the current setting to the minimum; if theValue is greater than the maximum
  8501. setting, it sets the current setting to the maximum).
  8502.  
  8503. æKY GetCtlValue
  8504. æFp Controls.p
  8505. æT FUNCTION
  8506. æTN A960
  8507. æD FUNCTION GetCtlValue(theControl: ControlHandle): INTEGER;
  8508.     INLINE $A960;
  8509. æDT myVariable := GetCtlValue(theControl);
  8510. æRI I-326, P-114, 171
  8511. æC 
  8512. GetCtlValue returns theControl’s current setting.
  8513.  
  8514. æKY SetCtlMin
  8515. æFp Controls.p
  8516. æT PROCEDURE
  8517. æTN A964
  8518. æD PROCEDURE SetCtlMin(theControl: ControlHandle;minValue: INTEGER);
  8519.     INLINE $A964;
  8520. æDT SetCtlMin(theControl,minValue);
  8521. æMM
  8522. æRI I-326
  8523. æC 
  8524. Assembly-language note:  The macro you invoke to call SetCtlMin from
  8525.                          assembly language is named _SetMinCtl.
  8526.  
  8527. SetCtlMin sets theControl’s minimum setting to minValue and redraws the control to
  8528. reflect the new range. If the control’s current setting is less than minValue, the
  8529. setting is changed to the new minimum.
  8530.  
  8531. æKY GetCtlMin
  8532. æFp Controls.p
  8533. æT FUNCTION
  8534. æTN A961
  8535. æD FUNCTION GetCtlMin(theControl: ControlHandle): INTEGER;
  8536.     INLINE $A961;
  8537. æDT myVariable := GetCtlMin(theControl);
  8538. æRI I-327
  8539. æC  
  8540. Assembly-language note:  The macro you invoke to call GetCtlMin from
  8541.                          assembly language is named _GetMinCtl.
  8542.  
  8543. GetCtlMin returns theControl’s minimum setting.
  8544.  
  8545. æKY SetCtlMax
  8546. æFp Controls.p
  8547. æT PROCEDURE
  8548. æTN A965
  8549. æD PROCEDURE SetCtlMax(theControl: ControlHandle;maxValue: INTEGER);
  8550.     INLINE $A965;
  8551. æDT SetCtlMax(theControl,maxValue);
  8552. æMM
  8553. æRI I-327
  8554. æC 
  8555. Assembly-language note:  The macro you invoke to call SetCtlMax from
  8556.                          assembly language is named _SetMaxCtl.
  8557.  
  8558. SetCtlMax sets theControl’s maximum setting to maxValue and redraws the control to
  8559. reflect the new range. If the control’s current setting is greater than maxValue, the
  8560. setting is changed to the new maximum.
  8561.  
  8562. Note:  If you set the maximum setting of a scroll bar equal to its minimum
  8563.        setting, the control definition function will make the scroll bar
  8564.        inactive.
  8565.  
  8566. æKY GetCtlMax
  8567. æFp Controls.p
  8568. æT FUNCTION
  8569. æTN A962
  8570. æD FUNCTION GetCtlMax(theControl: ControlHandle): INTEGER;
  8571.     INLINE $A962;
  8572. æDT myVariable := GetCtlMax(theControl);
  8573. æRI I-327
  8574. æC 
  8575. Assembly-language note:  The macro you invoke to call GetCtlMax from
  8576.                          assembly language is named _GetMaxCtl.
  8577.  
  8578. GetCtlMax returns theControl’s maximum setting.
  8579.  
  8580. æKY SetCRefCon
  8581. æFp Controls.p
  8582. æT PROCEDURE
  8583. æTN A95B
  8584. æD PROCEDURE SetCRefCon(theControl: ControlHandle;data: LONGINT);
  8585.     INLINE $A95B;
  8586. æDT SetCRefCon(theControl,data);
  8587. æRI I-327
  8588. æC 
  8589. SetCRefCon sets theControl’s reference value to the given data.
  8590.  
  8591. æKY GetCRefCon
  8592. æFp Controls.p
  8593. æT FUNCTION
  8594. æTN A95A
  8595. æD FUNCTION GetCRefCon(theControl: ControlHandle): LONGINT;
  8596.     INLINE $A95A;
  8597. æDT myVariable := GetCRefCon(theControl);
  8598. æRI I-327
  8599. æC 
  8600. GetCRefCon returns theControl’s current reference value.
  8601.  
  8602. æKY SetCtlAction
  8603. æFp Controls.p
  8604. æT PROCEDURE
  8605. æTN A96B
  8606. æD PROCEDURE SetCtlAction(theControl: ControlHandle;actionProc: ProcPtr);
  8607.     INLINE $A96B;
  8608. æDT SetCtlAction(theControl,actionProc);
  8609. æRI I-328
  8610. æC 
  8611. SetCtlAction sets theControl’s default action procedure to actionProc.
  8612.  
  8613. æKY GetCtlAction
  8614. æFp Controls.p
  8615. æT FUNCTION
  8616. æTN A96A
  8617. æD FUNCTION GetCtlAction(theControl: ControlHandle): ProcPtr;
  8618.     INLINE $A96A;
  8619. æDT myVariable := GetCtlAction(theControl);
  8620. æRI I-328, IV-53
  8621. æC  
  8622. GetCtlAction returns a pointer to theControl’s default action procedure, if any. (It
  8623. returns whatever is in that field of the control record.)
  8624.  
  8625. æKY DragControl
  8626. æFp Controls.p
  8627. æT PROCEDURE
  8628. æTN A967
  8629. æD PROCEDURE DragControl(theControl: ControlHandle;startPt: Point;limitRect: Rect;
  8630.     slopRect: Rect;axis: INTEGER);
  8631.     INLINE $A967;
  8632. æDT DragControl(theControl,startPt,limitRect,slopRect,axis);
  8633. æMM
  8634. æRI I-325
  8635. æC 
  8636. Called with the mouse button down inside theControl, DragControl pulls a dotted
  8637. outline of the control around the screen, following the movements of the mouse until
  8638. the button is released. When the mouse button is released, DragControl calls MoveControl
  8639. to move the control to the location to which it was dragged.
  8640.  
  8641. Note:  Before beginning to follow the mouse, DragControl calls the control
  8642.        definition function to allow it to do its own “custom dragging” if
  8643.        it chooses. If the definition function doesn’t choose to do any
  8644.        custom dragging, DragControl uses the default method of dragging
  8645.        described here.
  8646.  
  8647. The startPt, limitRect, slopRect, and axis parameters have the same meaning as for
  8648. the Window Manager function DragGrayRgn. These parameters are reviewed briefly below;
  8649. see the description of DragGrayRgn in the Window Manager chapter for more details.
  8650.  
  8651.   •  StartPt is assumed to be the point where the mouse button was originally
  8652.      pressed, in the local coordinates of the control’s window.
  8653.   •  LimitRect limits the travel of the control’s outline, and should normally
  8654.      coincide with or be contained within the window’s content region.
  8655.   •  SlopRect allows the user some “slop” in moving the mouse; it should
  8656.      completely enclose limitRect.
  8657.   •  The axis parameter allows you to constrain the control’s motion to
  8658.      only one axis. It has one of the following values:
  8659.  
  8660.        CONST  noConstraint = 0;    {no constraint}
  8661.               hAxisOnly    = 1;    {horizontal axis only}
  8662.               vAxisOnly    = 2;    {vertical axis only}
  8663.  
  8664. Assembly-language note:  Like TrackControl, DragControl invokes the
  8665.                          macro _DragTheRgn, so you can use the global
  8666.                          variables DragHook and DragPattern.
  8667.  
  8668. æKY TestControl
  8669. æFp Controls.p
  8670. æT FUNCTION
  8671. æTN A966
  8672. æD FUNCTION TestControl(theControl: ControlHandle;thePt: Point): INTEGER;
  8673.     INLINE $A966;
  8674. æDT myVariable := TestControl(theControl,thePt);
  8675. æMM
  8676. æRI I-325
  8677. æC  
  8678. If theControl is visible and active, TestControl tests which part of the control
  8679. contains thePoint (in the local coordinates of the control’s window); it returns the
  8680. corresponding part code, or 0 if the point is outside the control. If the control is
  8681. invisible or inactive, TestControl returns 0. TestControl is called by FindControl
  8682. and TrackControl; normally you won’t need to call it yourself.
  8683.  
  8684. æKY TrackControl
  8685. æFp Controls.p
  8686. æT FUNCTION
  8687. æTN A968
  8688. æD FUNCTION TrackControl(theControl: ControlHandle;thePoint: Point;actionProc: ProcPtr): INTEGER;
  8689.     INLINE $A968;
  8690. æDT myVariable := TrackControl(theControl,thePoint,actionProc);
  8691. æMM
  8692. æRI I-323, P-114, 184
  8693. æC 
  8694. When the mouse button is pressed in a visible, active control, the application should
  8695. call TrackControl with theControl equal to the control handle and startPt equal to
  8696. the point where the mouse button was pressed (in the local coordinates of the control’s
  8697. window). TrackControl follows the movements of the mouse and responds in whatever way
  8698. is appropriate until the mouse button is released; the exact response depends on the
  8699. type of control and the part of the control in which the mouse button was pressed. If
  8700. highlighting is appropriate, TrackControl does the highlighting, and undoes it before
  8701. returning. When the mouse button is released, TrackControl returns with the part code
  8702. if the mouse is in the same part of the control that it was originally in, or with 0
  8703. if not
  8704. (in which case the application should do nothing).
  8705.  
  8706. If the mouse button was pressed in an indicator, TrackControl drags a dotted outline
  8707. of it to follow the mouse. When the mouse button is released, TrackControl calls the
  8708. control definition function to reposition the control’s indicator. The control definition
  8709. function for scroll bars responds by redrawing the thumb, calculating the control’s
  8710. current setting based on the new relative position of the thumb, and storing the
  8711. current setting in the control record; for example, if the minimum and maximum settings
  8712. are 0 and 10, and the thumb is in the middle of the scroll bar, 5 is stored as the
  8713. current setting. The application must then scroll to the corresponding relative
  8714. position in the document.
  8715.  
  8716. TrackControl may take additional actions beyond highlighting the control or dragging
  8717. the indicator, depending on the value passed in the actionProc parameter, as described
  8718. below. The following tells you what to pass for the standard control types; for a
  8719. custom control, what you pass will depend on how the control is defined.
  8720.  
  8721.   •  If actionProc is NIL, TrackControl performs no additional actions. This
  8722.      is appropriate for simple buttons, check boxes, radio buttons, and the
  8723.      thumb of a scroll bar.
  8724.   •  ActionProc may be a pointer to an action procedure that defines some
  8725.      action to be performed repeatedly for as long as the user holds down
  8726.      the mouse button. (See below for details.)
  8727.   •  If actionProc is POINTER(–1), TrackControl looks in the control record
  8728.      for a pointer to the control’s default action procedure. If that field
  8729.      of the control record contains a procedure pointer, TrackControl uses
  8730.      the action procedure it points to; if the field contains POINTER (–1),
  8731.      TrackControl calls the control definition function to perform the
  8732.      necessary action. (If the field contains NIL, TrackControl does nothing.)
  8733.  
  8734. The action procedure in the control definition function is described in the section
  8735. “Defining Your Own Controls”. The following paragraphs describe only the action
  8736. procedure whose pointer is passed in the actionProc parameter or stored in the control
  8737. record.
  8738.  
  8739. If the mouse button was pressed in an indicator, the action procedure (if any) should
  8740. have no parameters. This procedure must allow for the fact that the mouse may not be
  8741. inside the original control part.
  8742.  
  8743. If the mouse button was pressed in a control part other than an indicator, the action
  8744. procedure should be of the form
  8745.  
  8746. PROCEDURE MyAction (theControl:  ControlHandle; partCode:  INTEGER);
  8747.  
  8748. In this case, TrackControl passes the control handle and the part code to the action
  8749. procedure. (It passes 0 in the partCode parameter if the mouse has moved outside the
  8750. original control part.) As an example of this type of action procedure, consider what
  8751. should happen when the mouse button is pressed in a scroll arrow or paging region in
  8752. a scroll bar. For these cases, your action procedure should examine the part code to
  8753. determine exactly where the mouse button was pressed, scroll up or down a line or
  8754. page as appropriate, and call SetCtlValue to change the control’s setting and redraw
  8755. the thumb.
  8756.  
  8757. Warning:  Since it has a different number of parameters depending on whether
  8758.           the mouse button was pressed in an indicator or elsewhere, the
  8759.           action procedure you pass to TrackControl (or whose pointer you
  8760.           store in the control record) can be set up for only one case or
  8761.           the other. If you store a pointer to a default action procedure
  8762.           in a control record, be sure it will be used only when appropriate
  8763.           for that type of action procedure. The only way to specify actions
  8764.           in response to all mouse-down events in a control, regardless of
  8765.           whether they’re in an indicator, is via the control definition
  8766.           function.
  8767.  
  8768. Assembly-language note:  If you store a pointer to a procedure in the global
  8769.                          variable DragHook, that procedure will be called
  8770.                          repeatedly (with no parameters) for as long as the
  8771.                          user holds down the mouse button. TrackControl
  8772.                          invokes the Window Manager macro _DragTheRgn,
  8773.                          which calls the DragHook procedure. _DragTheRgn
  8774.                          uses the pattern stored in the global variable
  8775.                          DragPattern for the dragged outline of the indicator.
  8776.  
  8777. æKY FindControl
  8778. æFp Controls.p
  8779. æT FUNCTION
  8780. æTN A96C
  8781. æD FUNCTION FindControl(thePoint: Point;theWindow: WindowPtr;VAR theControl: ControlHandle): INTEGER;
  8782.     INLINE $A96C;
  8783. æDT myVariable := FindControl(thePoint,theWindow,theControl);
  8784. æMM
  8785. æRI I-323, P-98, 114, 170
  8786. æC  
  8787. When the Window Manager function FindWindow reports that the mouse button was pressed
  8788. in the content region of a window, and the window contains controls, the application
  8789. should call FindControl with theWindow equal to the window pointer and thePoint equal
  8790. to the point where the mouse button was pressed (in the window’s local coordinates).
  8791. FindControl tells which of the window’s controls, if any, the mouse button was pressed
  8792. in:
  8793.  
  8794.   •  If it was pressed in a visible, active control, FindControl sets the
  8795.      whichControl parameter to the control handle and returns a part code
  8796.      identifying the part of the control that it was pressed in.
  8797.   •  If it was pressed in an invisible or inactive control, or not in any
  8798.      control, FindControl sets whichControl to NIL and returns 0 as its result.
  8799.  
  8800. Warning:  Notice that FindControl expects the mouse point in the window’s
  8801.           local coordinates, whereas FindWindow expects it in global
  8802.           coordinates. Always be sure to convert the point to local
  8803.           coordinates with the QuickDraw procedure GlobalToLocal before
  8804.           calling FindControl.
  8805.  
  8806. Note:  FindControl also returns NIL for whichControl and 0 as its result
  8807.        if the window is invisible or doesn’t contain the given point. In
  8808.        these cases, however, FindWindow wouldn’t have returned this window
  8809.        in the first place, so the situation should never arise.
  8810.  
  8811. æKY SetCtlColor
  8812. æFp Controls.p
  8813. æT PROCEDURE
  8814. æTN AA43
  8815. æD PROCEDURE SetCtlColor(theControl: ControlHandle;newColorTable: CCTabHandle);
  8816.     INLINE $AA43;
  8817. æDT SetCtlColor(theControl,newColorTable);
  8818. æMM
  8819. æRI V-222
  8820. æC 
  8821. [Macintosh II]
  8822.  
  8823. The SetCtlColor procedure sets or modifies a control’s color table.  If the control
  8824. currently has no auxiliary control record, a new one is created with the given color
  8825. table and added to the head of the auxiliary control list. If there is already an
  8826. auxiliary record for the control, its color table is replaced by the contents of
  8827. newColorTable.
  8828.  
  8829. If newColorTable has the same contents as the default color table, the
  8830. control’s existing auxiliary record and color table are removed from the auxiliary
  8831. control list and deallocated.  If theControl = NIL, the operation modifies the default
  8832. color table itself. If the control is visible, it will be redrawn by SetCtlColor
  8833. using the new color table.
  8834.  
  8835. æKY GetAuxCtl
  8836. æFp Controls.p
  8837. æT FUNCTION
  8838. æTN AA44
  8839. æD FUNCTION GetAuxCtl(theControl: ControlHandle;VAR acHndl: AuxCtlHandle): BOOLEAN;
  8840.     INLINE $AA44;
  8841. æDT myVariable := GetAuxCtl(theControl,acHndl);
  8842. æMM
  8843. æRI V-222
  8844. æC 
  8845. [Macintosh II]
  8846.  
  8847. The GetAuxCtl function returns a handle to a control’s AuxCtlRec:
  8848.  
  8849.   •  If the given control has its own color table, the function returns TRUE.
  8850.   •  If the control used the default color set, the function returns FALSE.
  8851.   •  If the control asked to receive the default color set (theControl = NIL),
  8852.      then the function returns TRUE.
  8853.  
  8854. æKY GetCVariant
  8855. æFp Controls.p
  8856. æT FUNCTION
  8857. æTN A809
  8858. æD FUNCTION GetCVariant(theControl: ControlHandle): INTEGER;
  8859.     INLINE $A809;
  8860. æDT myVariable := GetCVariant(theControl);
  8861. æRI V-222
  8862. æC 
  8863. [Macintosh Plus, Macintosh SE, and Macintosh II]
  8864.  
  8865. The GetVariant function returns the variant control value for the control described
  8866. by theControl. This value was formerly stored in the high four bits of the control
  8867. defproc handle; for future compatibility, use the GetCVariant routine to access this
  8868. value.
  8869.  
  8870.  
  8871. æKY CursorCtl.p
  8872. æKL Hide_Cursor
  8873. InitCursorCtl
  8874. RotateCursor
  8875. Show_Cursor
  8876. SpinCursor
  8877.  
  8878. Acur
  8879. acurHandle
  8880. acurPtr
  8881. ARROW_CURSOR
  8882. CROSS_CURSOR
  8883. Cursors
  8884. HIDDEN_CURSOR
  8885. I_BEAM_CURSOR
  8886. PLUS_CURSOR
  8887. WATCH_CURSOR
  8888.  
  8889.  
  8890. æKY Acur
  8891. acurPtr
  8892. acurHandle
  8893. æFp CursorCtl.p
  8894. æT TYPE
  8895. æD acurPtr = ^Acur;
  8896. acurHandle = ^acurPtr;
  8897. Acur = RECORD
  8898.    n: INTEGER;         {Number of cursors ("frames of film")}
  8899.    index: INTEGER;     { Next frame to show <for internal use>}
  8900.    frame1: INTEGER;    {'CURS' resource id for frame #1}
  8901.    fill1: INTEGER;     {<for internal use>}
  8902.    frame2: INTEGER;    {'CURS' resource id for frame #2}
  8903.    fill2: INTEGER;     {<for internal use>}
  8904.    frameN: INTEGER;    {'CURS' resource id for frame #N}
  8905.    fillN: INTEGER;     {<for internal use>}
  8906.    END;
  8907.  
  8908. æKY Cursors
  8909. HIDDEN_CURSOR
  8910. I_BEAM_CURSOR
  8911. CROSS_CURSOR
  8912. PLUS_CURSOR
  8913. WATCH_CURSOR
  8914. ARROW_CURSOR
  8915. æFp CursorCtl.p
  8916. æD Cursors = (HIDDEN_CURSOR,I_BEAM_CURSOR,CROSS_CURSOR,PLUS_CURSOR,WATCH_CURSOR,
  8917. ARROW_CURSOR);
  8918.  
  8919. æKY Hide_Cursor
  8920. æFp CursorCtl.p
  8921. æT PROCEDURE
  8922. æD PROCEDURE Hide_Cursor;
  8923. æDT Hide_Cursor;
  8924. æC 
  8925. { Hide the cursor if it is showing.This is this unit's call to the Mac
  8926. HideCursor routine.Thus the Mac cursor level is decremented by one when this
  8927. routine is called.
  8928.  }
  8929.  
  8930. æKY InitCursorCtl
  8931. æFp CursorCtl.p
  8932. æT PROCEDURE
  8933. æD PROCEDURE InitCursorCtl(newCursors: UNIV acurHandle);
  8934. æDT InitCursorCtl(newCursors);
  8935. æC 
  8936. { Initialize the CursorCtl unit. This should be called once prior to calling
  8937. RotateCursor or SpinCursor. It need not be called if only Hide_Cursor or
  8938. Show_Cursor are used. If NewCursors is NULL, InitCursorCtl loads in the
  8939. 'acur' resource and the 'CURS' resources specified by the 'acur' resource
  8940. ids.  If any of the resources cannot be loaded, the cursor will not be
  8941. changed.
  8942.  
  8943. The 'acur' resource is assumed to either be in the currently running tool or
  8944. application, or the MPW Shell for a tool, or in the System file.  The 'acur'
  8945. resource id must be 0 for a tool or application, 1 for the Shell, and 2 for
  8946. the System file.
  8947.  
  8948. If NewCursors is not NULL, it is ASSUMED to be a handle to an 'acur' formatted
  8949. resource designated by the caller and it will be used instead of doing a
  8950. GetResource on 'acur'. Note, if RotateCursor or SpinCursor are called without
  8951. calling InitCursorCtl, then RotateCursor and SpinCursor will do the call for
  8952. the user the first time it is called.  However, the possible disadvantage of
  8953. using this technique is that the resource memory allocated may have
  8954. undesirable affect (fragmentation?) on the application. Using InitCursorCtl
  8955. has the advantage of causing the allocation at a specific time determined by
  8956. the user.
  8957.  
  8958. Caution: InitCursorCtl MODIFIES the 'acur' resource in memory.  Specifically,
  8959. it changes each FrameN/fillN integer pair to a handle to the corresponding
  8960. 'CURS' resource also in memory.  Thus if NewCursors is not NULL when
  8961. InitCursorCtl is called, the caller must guarantee NewCursors always points to
  8962. a "fresh" copy of an 'acur' resource.  This need only be of concern to a
  8963. caller who wants to repeatly use multiple 'acur' resources during execution of
  8964. their programs.
  8965.  }
  8966.  
  8967. æKY RotateCursor
  8968. æFp CursorCtl.p
  8969. æT PROCEDURE
  8970. æD PROCEDURE RotateCursor(counter: LONGINT);
  8971. æDT RotateCursor(counter);
  8972. æC 
  8973. { RotateCursor is called to rotate the "I am active" "beach ball" cursor, or to
  8974. animate whatever sequence of cursors set up by InitCursorCtl. The next cursor
  8975. ("frame") is used when Counter % 32 = 0 (Counter is some kind of incrementing
  8976. or decrementing index maintained by the caller). A positive counter sequences
  8977. forward through the cursors (e.g., it rotates the "beach ball" cursor
  8978. clockwise), and a negative cursor sequences through the cursors backwards
  8979. (e.g., it rotates the "beach ball" cursor counterclockwise).  Note,
  8980. RotateCursor just does a Mac SetCursor call for the proper cursor picture.
  8981.   It is assumed the cursor is visible from a prior Show_Cursor call.
  8982.  }
  8983.  
  8984. æKY Show_Cursor
  8985. æFp CursorCtl.p
  8986. æT PROCEDURE
  8987. æD PROCEDURE Show_Cursor(cursorKind: Cursors);
  8988. æDT Show_Cursor(cursorKind);
  8989. æC 
  8990. { Increment the cursor level, which may have been decremented by Hide_Cursor,
  8991. and display the specified cursor if the level becomes 0 (it is never
  8992. incremented beyond 0).The CursorKind is the kind of cursor to show.  It is
  8993. one of the values HIDDEN_CURSOR, I_BEAM_CURSOR, CROSS_CURSOR, PLUS_CURSOR,
  8994. WATCH_CURSOR, and ARROW_CURSOR. Except for HIDDEN_CURSOR, a Mac SetCursor is 
  8995. done for the specified cursor prior to doing a ShowCursor.  HIDDEN_CURSOR just
  8996. causes a ShowCursor call.  Note, ARROW_CURSOR will only work correctly if
  8997. there is already a grafPort set up pointed to by 0(A5).
  8998.  }
  8999.  
  9000. æKY SpinCursor
  9001. æFp CursorCtl.p
  9002. æT PROCEDURE
  9003. æD PROCEDURE SpinCursor(increment: INTEGER);
  9004. æDT SpinCursor(increment);
  9005. æC 
  9006. { SpinCursor is similar in function to RotateCursor, except that instead of
  9007. passing a counter, an Increment is passed an added to a counter maintained
  9008. here.  SpinCursor is provided for those users who do not happen to have a
  9009. convenient counter handy but still want to use the spinning "beach ball"
  9010. cursor, or any sequence of cursors set up by InitCursorCtl.  A positive 
  9011. increment sequences forward through the curos (rotating the "beach ball"
  9012. cursor clockwise), and a negative increment sequences backward through the
  9013. cursors (rotating the "beach ball" cursor counter-clockwise).  A zero value
  9014. for the increment resets the counter to zero.  Note, it is the increment, and
  9015. not the value of the counter that determines the sequencing direction of the
  9016. cursor (and hence the spin direction of the "beach ball" cursor).
  9017.  }
  9018.  
  9019.  
  9020. æKY DatabaseAccess.p
  9021. æKL DBBreak
  9022. DBDisposeQuery
  9023. DBEnd
  9024. DBExec
  9025. DBGetConnInfo
  9026. DBGetErr
  9027. DBGetItem
  9028. DBGetNewQuery
  9029. DBGetQueryResults
  9030. DBGetResultHandler
  9031. DBGetSessionNum
  9032. DBInit
  9033. DBInstallResultHandler
  9034. DBKill
  9035. DBRemoveResultHandler
  9036. DBResultsToText
  9037. DBSend
  9038. DBSendItem
  9039. DBStartQuery
  9040. DBState
  9041. DBUnGetItem
  9042. InitDBPack
  9043. QuitDBPack
  9044.  
  9045. DBAsyncParamBlockRec
  9046. DBAsyncParmBlkPtr
  9047. DBColInfoRecord
  9048. kDBAboutToInit
  9049. kDBExecComplete
  9050. kDBGetItemComplete
  9051. kDBGetQueryResultsComplete
  9052. kDBInitComplete
  9053. kDBLastColFlag
  9054. kDBSendComplete
  9055. kDBStartQueryComplete
  9056. kDBUpdateWind
  9057. kDBWaitForever
  9058. QueryArray
  9059. QueryHandle
  9060. QueryListHandle
  9061. QueryListPtr
  9062. QueryPtr
  9063. QueryRecord
  9064. rcDBAsyncNotSupp
  9065. rcDBBadAsyncPB
  9066. rcDBBadDDEV
  9067. rcDBBadSessID
  9068. rcDBBadSessNum
  9069. rcDBBadType
  9070. rcDBBreak
  9071. rcDBError
  9072. rcDBExec
  9073. rcDBNoHandler
  9074. rcDBNull
  9075. rcDBPackNotInited
  9076. rcDBValue
  9077. rcDBWrongVersion
  9078. ResListElem
  9079. ResListHandle
  9080. ResultsRecord
  9081. typeAnyType
  9082. typeBoolean
  9083. typeChar
  9084. typeColBreak
  9085. typeDate
  9086. typeDecimal
  9087. typeDiscard
  9088. typeFloat
  9089. typeInteger
  9090. typeLBin
  9091. typeLChar
  9092. typeMoney
  9093. typeNone
  9094. typeRowBreak
  9095. typeSMFloat
  9096. typeSMInt
  9097. typeTime
  9098. typeTimeStamp
  9099. typeUnknown
  9100. typeVBin
  9101. typeVChar
  9102.  
  9103. æKY rcDBNull
  9104. æFp DatabaseAccess.p
  9105. æT CONST
  9106. æD 
  9107. {  OSErr error and status codes  }
  9108.  
  9109. rcDBNull = -800;
  9110. æC 
  9111.  
  9112. æKY rcDBValue
  9113. æFp DatabaseAccess.p
  9114. æT CONST
  9115. æD rcDBValue = -801;
  9116. æC 
  9117.  
  9118. æKY rcDBError
  9119. æFp DatabaseAccess.p
  9120. æT CONST
  9121. æD rcDBError = -802;
  9122. æC 
  9123.  
  9124. æKY rcDBBadType
  9125. æFp DatabaseAccess.p
  9126. æT CONST
  9127. æD rcDBBadType = -803;
  9128. æC 
  9129.  
  9130. æKY rcDBBreak
  9131. æFp DatabaseAccess.p
  9132. æT CONST
  9133. æD rcDBBreak = -804;
  9134. æC 
  9135.  
  9136. æKY rcDBExec
  9137. æFp DatabaseAccess.p
  9138. æT CONST
  9139. æD rcDBExec = -805;
  9140. æC 
  9141.  
  9142. æKY rcDBBadSessID
  9143. æFp DatabaseAccess.p
  9144. æT CONST
  9145. æD rcDBBadSessID = -806;
  9146. æC 
  9147.  
  9148. æKY rcDBBadSessNum
  9149. æFp DatabaseAccess.p
  9150. æT CONST
  9151. æD rcDBBadSessNum = -807; { bad session number for DBGetConnInfo }
  9152. æC 
  9153.  
  9154. æKY rcDBBadDDEV
  9155. æFp DatabaseAccess.p
  9156. æT CONST
  9157. æD rcDBBadDDEV = -808; { bad ddev specified on DBInit }
  9158. æC 
  9159.  
  9160. æKY rcDBAsyncNotSupp
  9161. æFp DatabaseAccess.p
  9162. æT CONST
  9163. æD rcDBAsyncNotSupp = -809; { ddev does not support async calls }
  9164. æC 
  9165.  
  9166. æKY rcDBBadAsyncPB
  9167. æFp DatabaseAccess.p
  9168. æT CONST
  9169. æD rcDBBadAsyncPB = -810; { tried to kill a bad pb }
  9170. æC 
  9171.  
  9172. æKY rcDBNoHandler
  9173. æFp DatabaseAccess.p
  9174. æT CONST
  9175. æD rcDBNoHandler = -811; { no app handler for specified data type }
  9176. æC 
  9177.  
  9178. æKY rcDBWrongVersion
  9179. æFp DatabaseAccess.p
  9180. æT CONST
  9181. æD rcDBWrongVersion = -812; { incompatible versions }
  9182. æC 
  9183.  
  9184. æKY rcDBPackNotInited
  9185. æFp DatabaseAccess.p
  9186. æT CONST
  9187. æD rcDBPackNotInited = -813; { attempt to call other routine before InitDBPack }
  9188. æC 
  9189.  
  9190. æKY kDBUpdateWind
  9191. æFp DatabaseAccess.p
  9192. æT CONST
  9193. æD 
  9194. {  messages for status functions for DBStartQuery  }
  9195.  
  9196. kDBUpdateWind = 0;
  9197. æC 
  9198.  
  9199. æKY kDBAboutToInit
  9200. æFp DatabaseAccess.p
  9201. æT CONST
  9202. æD kDBAboutToInit = 1;
  9203. æC 
  9204.  
  9205. æKY kDBInitComplete
  9206. æFp DatabaseAccess.p
  9207. æT CONST
  9208. æD kDBInitComplete = 2;
  9209. æC 
  9210.  
  9211. æKY kDBSendComplete
  9212. æFp DatabaseAccess.p
  9213. æT CONST
  9214. æD kDBSendComplete = 3;
  9215. æC 
  9216.  
  9217. æKY kDBExecComplete
  9218. æFp DatabaseAccess.p
  9219. æT CONST
  9220. æD kDBExecComplete = 4;
  9221. æC 
  9222.  
  9223. æKY kDBStartQueryComplete
  9224. æFp DatabaseAccess.p
  9225. æT CONST
  9226. æD kDBStartQueryComplete = 5;
  9227. æC 
  9228.  
  9229. æKY kDBGetItemComplete
  9230. æFp DatabaseAccess.p
  9231. æT CONST
  9232. æD 
  9233. {  messages for status functions for DBGetQueryResults  }
  9234.  
  9235. kDBGetItemComplete = 6;
  9236. æC 
  9237.  
  9238. æKY kDBGetQueryResultsComplete
  9239. æFp DatabaseAccess.p
  9240. æT CONST
  9241. æD kDBGetQueryResultsComplete = 7;
  9242. æC 
  9243.  
  9244. æKY typeNone
  9245. æFp DatabaseAccess.p
  9246. æT CONST
  9247. æD 
  9248. {  data type codes  }
  9249.  
  9250. typeNone = 'none';
  9251. æC 
  9252.  
  9253. æKY typeBoolean
  9254. æFp DatabaseAccess.p
  9255. æT CONST
  9256. æD typeBoolean = 'bool';
  9257. æC 
  9258.  
  9259. æKY typeSMInt
  9260. æFp DatabaseAccess.p
  9261. æT CONST
  9262. æD typeSMInt = 'smin';
  9263. æC 
  9264.  
  9265. æKY typeInteger
  9266. æFp DatabaseAccess.p
  9267. æT CONST
  9268. æD typeInteger = 'int ';
  9269. æC 
  9270.  
  9271. æKY typeSMFloat
  9272. æFp DatabaseAccess.p
  9273. æT CONST
  9274. æD typeSMFloat = 'smfl';
  9275. æC 
  9276.  
  9277. æKY typeFloat
  9278. æFp DatabaseAccess.p
  9279. æT CONST
  9280. æD typeFloat = 'flot';
  9281. æC 
  9282.  
  9283. æKY typeDate
  9284. æFp DatabaseAccess.p
  9285. æT CONST
  9286. æD typeDate = 'date';
  9287. æC 
  9288.  
  9289. æKY typeTime
  9290. æFp DatabaseAccess.p
  9291. æT CONST
  9292. æD typeTime = 'time';
  9293. æC 
  9294.  
  9295. æKY typeTimeStamp
  9296. æFp DatabaseAccess.p
  9297. æT CONST
  9298. æD typeTimeStamp = 'tims';
  9299. æC 
  9300.  
  9301. æKY typeChar
  9302. æFp DatabaseAccess.p
  9303. æT CONST
  9304. æD typeChar = 'char';
  9305. æC 
  9306.  
  9307. æKY typeDecimal
  9308. æFp DatabaseAccess.p
  9309. æT CONST
  9310. æD typeDecimal = 'decm';
  9311. æC 
  9312.  
  9313. æKY typeMoney
  9314. æFp DatabaseAccess.p
  9315. æT CONST
  9316. æD typeMoney = 'mony';
  9317. æC 
  9318.  
  9319. æKY typeVChar
  9320. æFp DatabaseAccess.p
  9321. æT CONST
  9322. æD typeVChar = 'vchr';
  9323. æC 
  9324.  
  9325. æKY typeVBin
  9326. æFp DatabaseAccess.p
  9327. æT CONST
  9328. æD typeVBin = 'vbin';
  9329. æC 
  9330.  
  9331. æKY typeLChar
  9332. æFp DatabaseAccess.p
  9333. æT CONST
  9334. æD typeLChar = 'lchr';
  9335. æC 
  9336.  
  9337. æKY typeLBin
  9338. æFp DatabaseAccess.p
  9339. æT CONST
  9340. æD typeLBin = 'lbin';
  9341. æC 
  9342.  
  9343. æKY typeDiscard
  9344. æFp DatabaseAccess.p
  9345. æT CONST
  9346. æD typeDiscard = 'disc';
  9347. æC 
  9348.  
  9349. æKY typeUnknown
  9350. æFp DatabaseAccess.p
  9351. æT CONST
  9352. æD 
  9353. {  "dummy" types for DBResultsToText  }
  9354.  
  9355. typeUnknown = 'unkn';
  9356. æC 
  9357.  
  9358. æKY typeColBreak
  9359. æFp DatabaseAccess.p
  9360. æT CONST
  9361. æD typeColBreak = 'cbrk';
  9362. æC 
  9363.  
  9364. æKY typeRowBreak
  9365. æFp DatabaseAccess.p
  9366. æT CONST
  9367. æD typeRowBreak = 'rbrk';
  9368. æC 
  9369.  
  9370. æKY typeAnyType
  9371. æFp DatabaseAccess.p
  9372. æT CONST
  9373. æD 
  9374. {  pass this in to DBGetItem for any data type  }
  9375.  
  9376. typeAnyType = 0;
  9377. æC 
  9378.  
  9379. æKY kDBWaitForever
  9380. æFp DatabaseAccess.p
  9381. æT CONST
  9382. æD 
  9383. {  infinite timeout value for DBGetItem  }
  9384.  
  9385. kDBWaitForever = -1;
  9386. æC 
  9387.  
  9388. æKY kDBLastColFlag
  9389. æFp DatabaseAccess.p
  9390. æT CONST
  9391. æD 
  9392. {  flag for last column in row for DBGetItem  }
  9393.  
  9394. kDBLastColFlag = $0001;
  9395. æC 
  9396.  
  9397. æKY DBAsyncParamBlockRec
  9398. DBAsyncParmBlkPtr
  9399. æFp DatabaseAccess.p
  9400. æT RECORD
  9401. æD DBAsyncParmBlkPtr = ^DBAsyncParamBlockRec;
  9402. DBAsyncParamBlockRec = RECORD
  9403.     completionProc: ProcPtr; { pointer to completion routine }
  9404.     result: OSErr; { result of call }
  9405.     userRef: long; { for application's use }
  9406.     ddevRef: long; { for ddev's use }
  9407.     reserved: long; { for internal use }
  9408.     END;
  9409. {  structure for resource list in QueryRecord 
  9410.  
  9411.  }
  9412. æC 
  9413.  
  9414. æKY ResListElem
  9415. ResListHandle
  9416. æFp DatabaseAccess.p
  9417. æT RECORD
  9418. æD ResListElem = RECORD
  9419.     theType: ResType; { resource type }
  9420.     id: word; { resource id }
  9421.     END;
  9422. {  structure for query list in QueryRecord  }
  9423. æC 
  9424.  
  9425. æKY QueryArray
  9426. QueryListPtr
  9427. QueryListHandle
  9428. æFp DatabaseAccess.p
  9429. æT RECORD
  9430. æD QuerListPtr = ^QueryArray;
  9431. QueryListHandle = ^QuerListPtr;
  9432.  
  9433. QueryArray = ARRAY [0..255] OF Handle;
  9434. æC 
  9435.  
  9436. æKY QueryRecord
  9437. QueryPtr
  9438. QueryHandle
  9439. æFp DatabaseAccess.p
  9440. æT RECORD
  9441. æD QueryPtr = ^QueryRecord;
  9442. QueryHandle = ^QueryPtr;
  9443. QueryRecord = RECORD
  9444.     version: short; { version }
  9445.     id: short; { id of 'qrsc' this came from }
  9446.     queryProc: Handle; { handle to query def proc }
  9447.     ddevName: Str63; { ddev name }
  9448.     host: Str255; { host }
  9449.     user: Str255; { user }
  9450.     password: Str255; { password }
  9451.     connStr: Str255; { connection string }
  9452.     currQuery: short; { current query }
  9453.     numQueries: short; { number of queries in queryList }
  9454.     queryList: QueryListHandle; { handle to list of queries }
  9455.     numRes: short; { number of resources in resList }
  9456.     resList: ResListHandle; { handle to list of other resources }
  9457.     dataHandle: Handle; { data used by query def proc }
  9458.     refCon: long; { query's reference value }
  9459.     END;
  9460. {  structure of column types array in ResultsRecord  }
  9461. æC 
  9462.  
  9463. æKY DBColInfoRecord
  9464. æFp DatabaseAccess.p
  9465. æT RECORD
  9466. æD DBColInfoRecord = RECORD
  9467.     len: word;
  9468.     places: word;
  9469.     flags: word;
  9470.     END;
  9471. æC 
  9472.  
  9473. æKY ResultsRecord
  9474. æFp DatabaseAccess.p
  9475. æT RECORD
  9476. æD ResultsRecord = RECORD
  9477.     numRows: short; { number of rows in result }
  9478.     numCols: short; { number of colums per row }
  9479.     colTypes: Handle; { data type array}
  9480.     colData: Handle; { actual results }
  9481.     colInfo: Handle; { DBColInfoRecord array }
  9482.     END;
  9483. æC 
  9484.  
  9485. æKY InitDBPack
  9486. æFp DatabaseAccess.p
  9487. æT FUNCTION
  9488. æTN A82F
  9489. æD FUNCTION InitDBPack: OSErr;
  9490.     INLINE $3F3C,$0004,$303C,$0100,$A82F;
  9491. æDT myVariable := InitDBPack(paramList);
  9492. æC 
  9493. You must call the InitDBPack function before you call any other Database Access
  9494. Manager routines. You must call the QuitDBPack function when you are finished
  9495. using the Database Access Manager.
  9496.  
  9497. FUNCTION InitDBPack : OSErr;
  9498.  
  9499. The InitDBPack function causes the Package Manager to load the Database Access
  9500. Manager into memory, if it has not already done so, and increments the Database
  9501. Access Manager use counter. The use counter prevents any application from
  9502. removing the Database Access Manager from memory while another application is
  9503. using it.  
  9504.  
  9505. The interface routine that implements the InitDBPack function includes a version
  9506. number for the Database Access Manager. If the package is a different version
  9507. than specified by the interface routine, then the InitDBPack function returns
  9508. the rcDBWrongVersion result code.
  9509.  
  9510. Result codes
  9511. noErr                0  No error
  9512. rcDBWrongVersion  –814  Wrong version number
  9513.  
  9514. æKY QuitDBPack
  9515. æFp DatabaseAccess.p
  9516. æT FUNCTION
  9517. æTN A82F
  9518. æD FUNCTION QuitDBPack: OSErr;
  9519.     INLINE $303C,$0001,$A82F;
  9520. æDT myVariable := QuitDBPack(paramList);
  9521. æC 
  9522. FUNCTION QuitDBPack : OSErr;
  9523.  
  9524. The QuitDBPack function decrements the Database Access Manager use counter. When
  9525. this counter equals 0, the QuitDBPack function removes the Database Access
  9526. Manager package from memory. Call this routine when your application is
  9527. terminating or when you are finished using the Database Access Manager. The use
  9528. counter prevents the QuitDBPack function from removing the Database Access
  9529. Manager from memory while any application is still using it.
  9530.  
  9531. Result codes
  9532. noErr                 0  No error
  9533. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9534.  
  9535. æKY DBInit
  9536. æFp DatabaseAccess.p
  9537. æT FUNCTION
  9538. æTN A82F
  9539. æD FUNCTION DBInit(VAR sessID: LONGINT;ddevName: Str63;host: Str255;user: Str255;
  9540.     passwd: Str255;connStr: Str255;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9541.     INLINE $303C,$0E02,$A82F;
  9542. æDT myVariable := DBInit(sessID,ddevName,host,user,passwd,connStr,asyncPB);
  9543. æC 
  9544. FUNCTION DBInit (VAR sessID: LongInt; ddevName: Str63; host, user, password,
  9545.                  connStr: Str255; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9546.  
  9547. The DBInit function initiates a session with a remote database server. You must
  9548. initiate a session before you call any Database Access Manager function that
  9549. requires a session ID as an input parameter. If the DBInit function returns a
  9550. nonzero session ID, you must call the DBEnd function to terminate the session,
  9551. even if the DBInit function also returns a result code other than noErr.
  9552.  
  9553. Because the high-level function DBStartQuery can call the DBInit function, if
  9554. you have called the DBStartQuery function, you do not have to call the DBInit
  9555. function. 
  9556.  
  9557. The DBInit function returns the session ID in the sessID parameter. This session
  9558. ID is unique; no other current session, for any database extension, has the same
  9559. session ID. You must specify the session ID any time you want to send data to or
  9560. retrieve data from this session. Depending on the database extension you are
  9561. using, the DBInit function might return a session ID of 0 if it fails to
  9562. initiate a session, or it might return a nonzero session ID and a result code
  9563. other than noErr. In the latter case, you can pass the session ID to the
  9564. DBGetErr function to determine the cause of the error.
  9565.  
  9566. The ddevName parameter is a string of no more than 63 characters that specifies
  9567. the name of the database extension. The name of the database extension is
  9568. contained in the database extension file in a resource of type 'STR ' with an ID
  9569. of 128. For the CL/1 database extension provided by Apple , for example, this
  9570. string is “CL/1”.
  9571.  
  9572. The host parameter specifies the name of the remote system on which the database
  9573. server is located. This name depends on the manner in which the database
  9574. extension establishes communication with the remote database server and on how
  9575. the system administrator has set up the computer system.
  9576.  
  9577. The user parameter specifies the name of the user, and the password parameter
  9578. specifies the password associated with the user name.
  9579.  
  9580. The connStr parameter is a connection string that is passed to the database
  9581. server, which might pass it on to the database management software on the remote
  9582. computer. This string is necessary in some systems to complete log-on
  9583. procedures. 
  9584. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9585. do not want to call the function asynchronously, set this parameter to NIL.
  9586.  
  9587. Result codes
  9588. noErr                 0  No error
  9589. rcDBError          –802  Error initiating session
  9590. rcDBBadDDev        –809  Couldn’t find specified database extension or 
  9591.                          trouble opening ddev file
  9592. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9593.                          database extension
  9594. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9595.  
  9596. æKY DBEnd
  9597. æFp DatabaseAccess.p
  9598. æT FUNCTION
  9599. æTN A82F
  9600. æD FUNCTION DBEnd(sessID: LONGINT;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9601.     INLINE $303C,$0403,$A82F;
  9602. æDT myVariable := DBEnd(sessID,asyncPB);
  9603. æC 
  9604. FUNCTION DBEnd (sessID: LongInt; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9605.  
  9606. The DBEnd function terminates a session with a remote database server and
  9607. terminates the network connection between the application and the remote
  9608. computer. You must call the DBEnd function to terminate a session.
  9609.  
  9610. The sessID parameter is the session ID that was returned by the DBInit function.
  9611.  
  9612. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9613. do not want to call the function asynchronously, set this parameter to NIL.
  9614.  
  9615. Result codes
  9616. noErr                 0  No error
  9617. rcDBError          –802  Error ending session
  9618. rcDBBadSessID      –807  Session ID is invalid
  9619. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9620.                          database extension
  9621. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9622.  
  9623. æKY DBGetConnInfo
  9624. æFp DatabaseAccess.p
  9625. æT FUNCTION
  9626. æTN A82F
  9627. æD FUNCTION DBGetConnInfo(sessID: long;sessNum: short;VAR returnID: long;version: long;
  9628.     VAR ddevName: Str63;VAR host: Str255;VAR user: Str255;VAR network: Str255;
  9629.     VAR connStr: Str255;VAR start: long;VAR state: OSErr;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9630.     INLINE $303C,$1704,$A82F;
  9631. æDT myVariable := DBGetConnInfo(sessID,sessNum,returnID,version,ddevName,host,user,network,connStr,start,state,asyncPB);
  9632. æC 
  9633. FUNCTION DBGetConnInfo (sessID: LongInt; sessNum: Integer; VAR returnedID,
  9634.                         version: LongInt; VAR ddevName: Str63; VAR host, user,
  9635.                         network, connStr: Str255; VAR start: LongInt; VAR state:
  9636.                         OSErr; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9637.  
  9638. The DBGetConnInfo function returns information about the specified session,
  9639. including 
  9640.  
  9641.   •   the version of the database extension
  9642.   •   the name of the remote system on which the session is running
  9643.   •   the user name
  9644.   •   the connection string that was used to establish communication
  9645.   •   the name of the network
  9646.   •   the time at which the session started, in ticks
  9647.   •   the status of the session
  9648.  
  9649. In addition, if you include a nonzero value for the sessID parameter when you
  9650. call the DBGetConnInfo function, the function returns the name of the database
  9651. extension. If you use 0 for the sessID parameter and specify the database
  9652. extension and session number instead, the function returns the session ID.
  9653.  
  9654. You can use this function to get information about a particular session, or you
  9655. can call the function repeatedly, incrementing the session number each time, to
  9656. get information about all of the sessions associated with a particular database
  9657. extension.
  9658.  
  9659. The sessID parameter is the session ID that was returned by the DBInit function.
  9660. The sessNum parameter is the session number of the session about which you want
  9661. information. You can specify either the session ID or the session number when
  9662. you call the DBInit function. If you specify the sessID parameter, use 0 for the
  9663. sessNum parameter. If you specify the sessNum parameter, then use 0 for the
  9664. sessID parameter. If you specify the sessNum parameter, you must specify a value
  9665. for the ddevName parameter as well. If you specify the session number and the
  9666. database extension, then the DBGetConnInfo function returns the session ID in
  9667. the returnedID parameter. 
  9668.  
  9669. The version parameter returns the version number of the database extension that
  9670. is the interface to the remote database server on which this session is running.
  9671.  
  9672. The ddevName parameter specifies the name of the database extension. If you
  9673. specify 0 for the session ID, you must include the name of the database
  9674. extension as well as a session number. If you specify a valid session ID, then
  9675. the DBGetConnInfo function returns the name of the database extension in the
  9676. ddevName parameter. The name of the database extension is included in a 'STR '
  9677. resource in the database extension file with a resource ID of 128.
  9678.  
  9679. The host, user, and connStr parameters are the host, user, and connection
  9680. strings that were used to establish communication with the remote database
  9681. server. The network parameter is the name of the network through which your
  9682. computer is communicating with the remote database server.
  9683.  
  9684. The start parameter is the time, in ticks, at which this session was initiated.
  9685.  
  9686. The state parameter returns one of the following values to provide information
  9687. about the status of the session:
  9688.  
  9689. CONST
  9690. noErr      =    0  ;No error; ready for more text
  9691. rcDBValue  = –801  ;Output data available
  9692. rcDBError  = –802  ;Execution ended in an error
  9693. rcDBExec   = –806  ;Busy; currently executing query
  9694.  
  9695. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9696. do not want to call the function asynchronously, set this parameter to NIL.
  9697.  
  9698. Result codes
  9699. noErr                 0  No error
  9700. rcDBBadSessNum     –808  Invalid session number
  9701. rcDBBadSessID      –807  Session ID is invalid or database extension name is 
  9702.                          invalid
  9703. rcDBBadDDev        –809  Couldn’t find specified database extension or 
  9704.                          trouble opening ddev file
  9705. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9706.                          database extension
  9707. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9708.  
  9709. æKY DBGetSessionNum
  9710. æFp DatabaseAccess.p
  9711. æT FUNCTION
  9712. æTN A82F
  9713. æD FUNCTION DBGetSessionNum(sessID: LONGINT;VAR sessNum: INTEGER;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9714.     INLINE $303C,$0605,$A82F;
  9715. æDT myVariable := DBGetSessionNum(sessID,sessNum,asyncPB);
  9716. æC 
  9717. FUNCTION DBGetSessionNum (sessID: LongInt; VAR sessNum: Integer; 
  9718.                           asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9719.  
  9720. The DBGetSessionNum function returns the session number of the session you
  9721. specify with the session ID parameter. The session number is unique for a
  9722. particular database extension, but the same session number might be in use for
  9723. different database extensions at the same time.
  9724.  
  9725. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9726. do not want to call the function asynchronously, set this parameter to NIL.
  9727.  
  9728. Result codes
  9729. noErr                 0  No error
  9730. rcDBBadSessID      –807  Session ID is invalid
  9731. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9732.                          database extension
  9733. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9734.  
  9735.  
  9736.  
  9737. æKY DBSend
  9738. æFp DatabaseAccess.p
  9739. æT FUNCTION
  9740. æTN A82F
  9741. æD FUNCTION DBSend(sessID: LONGINT;text: Ptr;len: INTEGER;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9742.     INLINE $303C,$0706,$A82F;
  9743. æDT myVariable := DBSend(sessID,text,len,asyncPB);
  9744. æC 
  9745. FUNCTION DBSend (sessID: LongInt; text: Ptr; len: Integer; asyncPB: 
  9746.                  DBAsyncParmBlkPtr) : OSErr;
  9747.  
  9748. The DBSend function sends a query or a portion of a query to the remote database
  9749. server. The database server appends this portion of the query to any portion you
  9750. sent previously. Because the Database Access Manager and database server do not
  9751. modify the string you send in any way, they do not insert any delimiter between
  9752. fragments of queries that you send to the database server. If you want a blank
  9753. or a semicolon to be included between query fragments, or if you want to use
  9754. return characters to divide the query into lines of text, you must include them
  9755. in the character string that you send with this function. 
  9756.  
  9757. The database server does not execute the query until you call the DBExec
  9758. function.
  9759.  
  9760. The sessID parameter is the session ID that was returned by the DBInit function.
  9761.  
  9762. The text parameter is a pointer to the query or query fragment that you want to
  9763. send to the database server. The query or query fragment must be a character
  9764. string. The len parameter specifies the length of the character string. If the
  9765. len parameter has a value of –1, then the character string is assumed to be 
  9766. “NULL terminated” (that is, the string ends with a NULL byte); otherwise, the
  9767. len parameter specifies the number of bytes in the string.
  9768.  
  9769. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9770. do not want to call the function asynchronously, set this parameter to NIL.
  9771.  
  9772. Result codes
  9773. noErr                 0  No error
  9774. rcDBError          –802  Error trying to send text
  9775. rcDBBadSessID      –807  Session ID is invalid
  9776. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9777.                          database extension
  9778. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9779.  
  9780. æKY DBSendItem
  9781. æFp DatabaseAccess.p
  9782. æT FUNCTION
  9783. æTN A82F
  9784. æD FUNCTION DBSendItem(sessID: LONGINT;dataType: DBType;len: INTEGER;places: INTEGER;
  9785.     flags: INTEGER;buffer: Ptr;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9786.     INLINE $303C,$0B07,$A82F;
  9787. æDT myVariable := DBSendItem(sessID,dataType,len,places,flags,buffer,asyncPB);
  9788. æC 
  9789. FUNCTION DBSendItem (sessID: LongInt; dataType: DBType; len, places, flags:
  9790.                      Integer; buffer: Ptr; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9791.  
  9792. The DBSendItem function sends a single data item to the remote database server.
  9793. You can use this function to send to the database server the data that you wish
  9794. to include in a query. The database extension or the database server (depending
  9795. on how the system is implemented) converts the data item to a character string
  9796. and appends it to the query, just as a query program fragment is appended to the
  9797. query by the DBSend function. The query is not executed until you call the
  9798. DBExec function.
  9799.  
  9800. The sessID parameter is the session ID that was returned by the DBInit function.
  9801.  
  9802. The dataType, len, and places parameters specify the data type, length, and
  9803. number of decimal places for the data item that you are sending to the remote
  9804. database server. The database extension and database server ignore the len
  9805. parameter if the data type has an implied length. The database extension and
  9806. database server ignore the places parameter for all values of the dataType
  9807. parameter except typeDecimal and typeMoney. Data types are discussed in “Getting
  9808. Query Results” earlier in this chapter.
  9809.  
  9810. The buffer parameter is a pointer to the memory location of the data item that
  9811. you want to send. When you use the DBSendItem function to send an item of data
  9812. to a database server, the database extension and database server format the data
  9813. according to the data type, length, and decimal places you specified, converts
  9814. it to a character string, and appends the data to the query. 
  9815.  
  9816. Set the flags parameter to 0. There are no flags currently defined for the
  9817. DBSendItem function. 
  9818.  
  9819. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9820. do not want to call the function asynchronously, set this parameter to NIL.
  9821.  
  9822. Result codes
  9823. noErr                 0  No error
  9824. rcDBError          –802  Error trying to send item
  9825. rcDBBadSessID      –807  Session ID is invalid
  9826. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9827.                          database extension
  9828. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9829.  
  9830.  
  9831. æKY DBExec
  9832. æFp DatabaseAccess.p
  9833. æT FUNCTION
  9834. æTN A82F
  9835. æD FUNCTION DBExec(sessID: LONGINT;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9836.     INLINE $303C,$0408,$A82F;
  9837. æDT myVariable := DBExec(sessID,asyncPB);
  9838. æC 
  9839. FUNCTION DBExec (sessID: LongInt; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9840.  
  9841. The DBExec function initiates execution of a query that you have sent to the
  9842. remote database server. Use the DBSend and DBSendItem functions to send a query
  9843. to the database server. Use the DBState function to determine the status of a
  9844. query after you have initiated execution.
  9845.  
  9846. The sessID parameter is the session ID that was returned by the DBInit function.
  9847.  
  9848. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9849. do not want to call the function asynchronously, set this parameter to NIL.
  9850.  
  9851. Result codes
  9852. noErr                 0  Execution has begun
  9853. rcDBError          –802  Error trying to begin execution
  9854. rcDBBadSessID      –807  Session ID is invalid
  9855. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9856.                          database extension
  9857. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9858.  
  9859. æKY DBState
  9860. æFp DatabaseAccess.p
  9861. æT FUNCTION
  9862. æTN A82F
  9863. æD FUNCTION DBState(sessID: LONGINT;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9864.     INLINE $303C,$0409,$A82F;
  9865. æDT myVariable := DBState(sessID,asyncPB);
  9866. æC 
  9867. FUNCTION DBState (sessID: LongInt; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9868.  
  9869. The result code returned by the DBState function indicates the status of the
  9870. remote database server. You can use this function to determine whether the
  9871. database server has successfully executed a query and whether it has data
  9872. available for you to retrieve. 
  9873.  
  9874. The sessID parameter is the session ID that was returned by the DBInit function.
  9875.  
  9876. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9877. do not want to call the function asynchronously, set this parameter to NIL.
  9878.  
  9879. Result codes
  9880. noErr                 0  No error; ready for more text
  9881. rcDBValue          –801  Output data available
  9882. rcDBError          –802  Execution ended in an error
  9883. rcDBExec           –806  Currently executing query
  9884. rcDBBadSessID      –807  Session ID is invalid
  9885. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by
  9886.                          database extension
  9887. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9888.  
  9889. æKY DBGetErr
  9890. æFp DatabaseAccess.p
  9891. æT FUNCTION
  9892. æTN A82F
  9893. æD FUNCTION DBGetErr(sessID: long;VAR err1: long;VAR err2: long;VAR item1: Str255;
  9894.     VAR item2: Str255;VAR errorMsg: Str255;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9895.     INLINE $303C,$0E0A,$A82F;
  9896. æDT myVariable := DBGetErr(sessID,err1,err2,item1,item2,errorMsg,asyncPB);
  9897. æC 
  9898. FUNCTION DBGetErr (sessID: LongInt; VAR err1,err2: LongInt; VAR item1, item2, 
  9899.                    errorMsg: Str255; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  9900.  
  9901. The DBGetErr function retrieves error codes and error messages from a remote
  9902. database server. You can use this function to obtain information when a
  9903. low-level function returns the result code rcDBError. If the DBState function
  9904. returns the rcDBError result code, indicating that execution of a query ended in
  9905. an error, the error information can help you debug the query. The meaning of
  9906. each error code and error message returned by this function depends on the
  9907. database server with which you are communicating; see the documentation for that
  9908. database server for more information.
  9909.  
  9910. The sessID parameter is the session ID that was returned by the DBInit function.
  9911.  
  9912. The err1 and err2 parameters return the primary and secondary error codes. The
  9913. item1 and item2 parameters return strings that describe the objects of the error
  9914. message. The errorMsg parameter returns the error message.
  9915.  
  9916. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9917. do not want to call the function asynchronously, set this parameter to NIL.
  9918.  
  9919. Result codes
  9920. noErr                 0  No error
  9921. rcDBError          –802  Error retrieving error information
  9922. rcDBBadSessID      –807  Session ID is invalid
  9923. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by
  9924.                          database extension
  9925. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9926.  
  9927. æKY DBBreak
  9928. æFp DatabaseAccess.p
  9929. æT FUNCTION
  9930. æTN A82F
  9931. æD FUNCTION DBBreak(sessID: LONGINT;abort: BOOLEAN;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9932.     INLINE $303C,$050B,$A82F;
  9933. æDT myVariable := DBBreak(sessID,abort,asyncPB);
  9934. æC 
  9935. FUNCTION DBBreak (sessID: LongInt; abort: Boolean; asyncPB: DBAsyncParmBlkPtr) :
  9936.                   OSErr;
  9937.  
  9938. The DBBreak function can halt execution of a query and reinitialize the remote
  9939. database server, or it can unconditionally terminate a session with a database
  9940. server. You can use this function to cancel a query if you determine that it is
  9941. taking too long to complete execution, for example.
  9942.  
  9943. The sessID parameter is the session ID that was returned by the DBInit function.
  9944.  
  9945. If the abort parameter is TRUE (nonzero), the database server halts any query
  9946. that is executing and terminates the current session. If the abort parameter is
  9947. FALSE (0), the database server halts any query that is executing and
  9948. reinitializes itself.
  9949.  
  9950. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  9951. do not want to call the function asynchronously, set this parameter to NIL.
  9952.  
  9953. Result codes
  9954. noErr                 0  Execution has begun
  9955. rcDBError          –802  Break or abort attempt was unsuccessful
  9956. rcDBBadSessID      –807  Session ID is invalid
  9957. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  9958.                          database extension
  9959. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  9960.  
  9961. æKY DBGetItem
  9962. æFp DatabaseAccess.p
  9963. æT FUNCTION
  9964. æTN A82F
  9965. æD FUNCTION DBGetItem(sessID: LONGINT;timeout: LONGINT;VAR dataType: Byte;
  9966.     VAR len: sort;VAR places: INTEGER;VAR flags: INTEGER;buffer: Ptr;asyncPB: DBAsyncParmBlkPtr): OSErr;
  9967.     INLINE $303C,$100C,$A82F;
  9968. æDT myVariable := DBGetItem(sessID,timeout,dataType,len,places,flags,buffer,asyncPB);
  9969. æC 
  9970. FUNCTION DBGetItem (sessID: LongInt; timeout: LongInt; VAR dataType: DBType; VAR
  9971.                     len,places,flags: Integer; buffer: Ptr; asyncPB: 
  9972.                     DBAsyncParmBlkPtr) : OSErr;
  9973.  
  9974. The DBGetItem function retrieves the next data item from the database server.
  9975. You can also use this function to obtain information about the next data item
  9976. without retrieving the data. You can use the DBGetItem function after you have
  9977. executed a query and the DBState function has returned the result code
  9978. rcDBValue, indicating that data is available. You can repeat the DBGetItem
  9979. function as many times as is necessary to retrieve all of the data returned by
  9980. the database in response to a query.
  9981.  
  9982. The sessID parameter is the session ID that was returned by the DBInit function.
  9983.  
  9984. You can use the timeout parameter to specify the maximum amount of time that the
  9985. database extension should wait to receive results from the database server
  9986. before canceling the function. Specify the timeout parameter in sixtieths of a
  9987. second. To disable the timeout feature, set the timeout parameter to the value
  9988. kDBWaitForever. If the timeout period expires, the DBGetItem function returns
  9989. the result code rcDBBreak. The DBGetItem function ignores the timeout parameter
  9990. if you call the function asynchronously. 
  9991.  
  9992. One use for the timeout parameter is to call the DBGetItem function periodically
  9993. with a short value set for this parameter in order to return control to your
  9994. application while a query is executing. Your application can then retrieve the
  9995. next data item as soon as execution of the query is complete without having to
  9996. call the DBState function to determine when data is available.
  9997.  
  9998. You can set the dataType parameter to specify the data type that you expect the
  9999. next data item to be. If the item is not of the expected data type, the database
  10000. extension returns the rcDBBadType result code. If you want to retrieve the next
  10001. data item regardless of type, set the dataType parameter to the value
  10002. typeAnyType. To skip the next data item, set the dataType parameter to the value
  10003. typeDiscard. The database server sets the dataType parameter to the actual type
  10004. of the data item when it retrieves the data item or returns information about
  10005. the data item. Data types are discussed in “Getting Query Results” earlier in
  10006. this chapter.
  10007.  
  10008. Set the len parameter to the length of the data buffer pointed to by the buffer
  10009. parameter. If you use the DBGetItem function to obtain information only (by
  10010. setting the buffer parameter to NIL), then the database server ignores the len
  10011. parameter. The database server sets the len parameter to the actual length of
  10012. the data item when it retrieves the data item or returns information about the
  10013. data item.
  10014.  
  10015. The database server returns in the places parameter the number of decimal places
  10016. in data items of types typeMoney and typeDecimal. For all other data types, the
  10017. database server returns 0 for the places parameter.
  10018.  
  10019. The buffer parameter is a pointer to the location where you want the retrieved
  10020. data item to be stored. You must ensure that the location you specify contains
  10021. enough space for the data item that will be returned. To determine the data
  10022. type, length, and number of decimal places of the next data item without
  10023. retrieving it, specify NIL for the buffer parameter. 
  10024.  
  10025. If the flags parameter is set to kDBLastColFlag (that is, the least significant
  10026. bit is set to 1), the data item is in the last column of the row. 
  10027. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  10028. do not want to call the function asynchronously, set this parameter to NIL.
  10029.  
  10030. Result codes
  10031. noErr                 0  No error; no next data item
  10032. rcDBNull           –800  The data item was NULL
  10033. rcDBValue          –801  A nonzero data item was successfully retrieved
  10034. rcDBError          –802  Execution ended in an error
  10035. rcDBBadType        –803  Next data item not of requested data type
  10036. rcDBBreak          –805  Timed out
  10037. rcDBBadSessID      –807  Session ID is invalid
  10038. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  10039.                          database extension
  10040. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10041.  
  10042. æKY DBUnGetItem
  10043. æFp DatabaseAccess.p
  10044. æT FUNCTION
  10045. æTN A82F
  10046. æD FUNCTION DBUnGetItem(sessID: LONGINT;asyncPB: DBAsyncParmBlkPtr): OSErr;
  10047.     INLINE $303C,$040D,$A82F;
  10048. æDT myVariable := DBUnGetItem(sessID,asyncPB);
  10049. æC 
  10050. FUNCTION DBUnGetItem (sessID: LongInt; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  10051.  
  10052. The DBUnGetItem function reverses the effect of the last call to the DBGetItem
  10053. function, in the sense that the next time you call the DBGetItem function it
  10054. retrieves the same item a second time. It does not remove the just-retrieved
  10055. data item from the input buffer. The DBUnGetItem function can reverse the effect
  10056. of only one call to the DBGetItem function; you cannot use it to step back
  10057. through several previously retrieved data items. 
  10058.  
  10059. The sessID parameter is the session ID that was returned by the DBInit function.
  10060.  
  10061. The asyncPB parameter is a pointer to the asynchronous parameter block. If you
  10062. do not want to call the function asynchronously, set this parameter to NIL.
  10063.  
  10064. Result codes
  10065. noErr                 0  No error
  10066. rcDBError          –802  Error executing function
  10067. rcDBBadSessID      –807  Session ID is invalid
  10068. rcDBAsyncNotSupp   –811  Asynchronous calls are not supported by 
  10069.                          database extension
  10070. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10071.  
  10072. æKY DBKill
  10073. æFp DatabaseAccess.p
  10074. æT FUNCTION
  10075. æTN A82F
  10076. æD FUNCTION DBKill(asyncPB: DBAsyncParmBlkPtr): OSErr;
  10077.     INLINE $303C,$020E,$A82F;
  10078. æDT myVariable := DBKill(asyncPB);
  10079. æC 
  10080. FUNCTION DBKill (asyncPB: DBAsyncParmBlkPtr) : OSErr;
  10081.  
  10082. The DBKill function cancels the execution of the asynchronous call specified by
  10083. the asyncPB parameter.
  10084.  
  10085. The asyncPB parameter is a pointer to the asynchronous parameter block.
  10086.  
  10087. Result codes
  10088. noErr                 0  Asynchronous routine canceled successfully
  10089. rcDBError          –802  Error canceling routine
  10090. rcDBBadAsynchPB    –812  Invalid parameter block specified
  10091. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10092.  
  10093. æKY DBGetNewQuery
  10094. æFp DatabaseAccess.p
  10095. æT FUNCTION
  10096. æTN A82F
  10097. æD FUNCTION DBGetNewQuery(queryID: INTEGER;VAR qeury: QueryHandle): OSErr;
  10098.     INLINE $303C,$030F,$A82F;
  10099. æDT myVariable := DBGetNewQuery(queryID,qeury);
  10100. æC 
  10101. FUNCTION DBGetNewQuery (queryID: Integer; VAR query: QueryHandle) : OSErr;
  10102.  
  10103. The DBGetNewQuery function creates a query record from the 'qrsc' resource with
  10104. the resource ID you specify in the queryID parameter. The resource file that
  10105. contains the 'qrsc' resource must remain open until after the DBStartQuery
  10106. function has completed execution. If you do not already know the resource ID of
  10107. the 'qrsc' resource (for example, if you call the SFGetFile procedure to let the
  10108. user select the query document), you can use Resource Manager routines to
  10109. determine the resource ID. The SFGetFile procedure is described in the Standard
  10110. File Package chapter of Volume I and the Resource Manager is described in Volume
  10111. Chapter 5.
  10112.  
  10113. The queryID parameter specifies the resource ID of the 'qrsc' resource that you
  10114. want to use. The query parameter returns a handle to the query record.
  10115.  
  10116. Result code
  10117. noErr                 0  Query record built successfully
  10118. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10119.  
  10120. æKY DBDisposeQuery
  10121. æFp DatabaseAccess.p
  10122. æT FUNCTION
  10123. æTN A82F
  10124. æD FUNCTION DBDisposeQuery(query: QueryHandle): OSErr;
  10125.     INLINE $303C,$0210,$A82F;
  10126. æDT myVariable := DBDisposeQuery(query);
  10127. æC 
  10128. FUNCTION DBDisposeQuery (query: QueryHandle) : OSErr;
  10129.  
  10130. The DBDisposeQuery function disposes of a query record and frees all the memory
  10131. that the Database Access Manager allocated when it created the query record. You
  10132. should call this function after you are finished using a query record.
  10133.  
  10134. The query parameter is a handle to the query record.
  10135.  
  10136. Result code
  10137. noErr                 0  Query record disposed of successfully
  10138. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10139.  
  10140. æKY DBStartQuery
  10141. æFp DatabaseAccess.p
  10142. æT FUNCTION
  10143. æTN A82F
  10144. æD FUNCTION DBStartQuery(VAR sessID: long;query: QueryHandle;statusProc: ProcPtr;
  10145.     asyncPB: DBAsyncParmBlkPtr): OSErr;
  10146.     INLINE $303C,$0811,$A82F;
  10147. æDT myVariable := DBStartQuery(sessID,query,statusProc,asyncPB);
  10148. æC 
  10149. FUNCTION DBStartQuery (VAR sessID: LongInt; query: QueryHandle; statusProc:
  10150.                        ProcPtr; asyncPB: DBAsyncParmBlkPtr) : OSErr;
  10151.  
  10152. The DBStartQuery function performs the following tasks, in the order specified:
  10153.  
  10154. 1.  It calls the query definition function (if any) pointed to by the query
  10155. record. The query definition function modifies the query record and the query,
  10156. usually by asking the user for input. The query definition function can display
  10157. a dialog box that gives the user the option of canceling the query; if the user
  10158. does cancel the query, the DBStartQuery function returns the userCanceledErr
  10159. result code.
  10160.  
  10161. 2.  If you specify a nonzero value for the statusProc parameter, the
  10162. DBStartQuery function calls your status routine with the value kDBUpdateWind in
  10163. the message parameter so that your application can update its windows.
  10164.  
  10165. 3.  If you specify a nonzero value for the statusProc parameter, the
  10166. DBStartQuery function calls your status routine with the value kDBAboutToInit in
  10167. the message parameter so that your application can display a dialog box
  10168. informing the user that a database session is about to be established, and
  10169. giving the user the option of canceling execution of the function.
  10170.  
  10171. 4.  If the sessID parameter is 0, the DBStartQuery function calls the DBInit
  10172. function to establish a database session, and returns a session ID. 
  10173.  
  10174. 5.  If you specify a nonzero value for the statusProc parameter and the
  10175. DBStartQuery function called the DBInit function, the DBStartQuery function
  10176. calls your status routine with the value kDBInitComplete in the message
  10177. parameter and the result of the DBInit function in the result parameter.
  10178.  
  10179. 6.  The DBStartQuery function calls the DBSend function to send the query to the
  10180. remote database server.
  10181.  
  10182. 7.  If you specify a nonzero value for the statusProc parameter, the
  10183. DBStartQuery function calls your status routine with the value kDBSendComplete
  10184. in the message parameter and the result of the DBSend function in the result
  10185. parameter.
  10186.  
  10187. 8.  The DBStartQuery function calls the DBExec function to execute the query.
  10188.  
  10189. 9.  If you specify a nonzero value for the statusProc parameter, the
  10190. DBStartQuery function calls your status routine with the value kDBExecComplete
  10191. in the message parameter and the result of the DBExec function in the result
  10192. parameter.
  10193.  
  10194. 10.  If you specify a nonzero value for the statusProc parameter, the
  10195. DBStartQuery function calls your status routine with the value
  10196. kDBStartQueryComplete in the message parameter and the result of the
  10197. DBStartQuery function in the result parameter.
  10198.  
  10199. You can use the sessID parameter to specify a session ID if your application or
  10200. another application has already established a session with the database server.
  10201. If you specify NIL for this parameter, then the DBStartQuery function
  10202. establishes a session and returns the session ID in the sessID parameter.
  10203.  
  10204. You use the query parameter to specify a handle to a query record. 
  10205. You can use the statusProc pointer to specify a pointer to a status routine that
  10206. your application can use to update its windows after the query definition
  10207. function has completed execution. If you specify NIL for this parameter, the
  10208. DBStartQuery function does not attempt to update your application’s windows. The
  10209. DBStartQuery function also calls your status routine before it initiates a
  10210. database session, after it calls the DBInit function, after it calls the DBSend
  10211. function, and after it calls the DBExec function. Status routines are discussed
  10212. in “Writing a Status Routine for High-Level Functions” earlier in this chapter.
  10213.  
  10214. If you specify a pointer to an asynchronous parameter block in the asyncPB
  10215. parameter, the DBStartQuery function calls the DBInit, DBSend, and DBExec
  10216. functions asynchronously. As soon as the DBInit function has started execution,
  10217. it returns control to your application. Your application must then call the
  10218. WaitNextEvent routine periodically to allow these asynchronous routines to run,
  10219. and it must check the result field of the asynchronous parameter block to
  10220. determine when each routine has completed execution.
  10221.  
  10222. Result codes
  10223. noErr                 0  No error
  10224. userCanceledErr    –128  User canceled the query 
  10225. rcDBError          –802  Error initiating session, sending text, or executing 
  10226.                          query
  10227. rcDBBadDDev        –809  Couldn’t find the specified database extension, or
  10228.                          error occurred in opening database extension   
  10229. rcDBAsyncNotSupp   –811  The database extension does not support asynchronous
  10230.                          calls
  10231. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10232.  
  10233.  
  10234. æKY DBGetQueryResults
  10235. æFp DatabaseAccess.p
  10236. æT FUNCTION
  10237. æTN A82F
  10238. æD FUNCTION DBGetQueryResults(sessID: LONGINT;VAR results: ResultsRecord;timeout: LONGINT;
  10239.     statusProc: ProcPtr;asyncPB: DBAsyncParmBlkPtr): OSErr;
  10240.     INLINE $303C,$0A12,$A82F;
  10241. æDT myVariable := DBGetQueryResults(sessID,results,timeout,statusProc,asyncPB);
  10242. æC 
  10243. FUNCTION DBGetQueryResults (sessID: LongInt; VAR results: ResultsRecord;
  10244.                             timeout: LongInt; statusProc: ProcPtr; 
  10245.                             asyncPB: DBAsyncParmBlkPtr) : OSErr;
  10246.  
  10247. The DBGetQueryResults function retrieves the results returned by a query and
  10248. places them in memory. If there is sufficient memory available, this function
  10249. retrieves all of the results at once. If the DBGetQueryResults function runs out
  10250. of memory, it places as much data as possible in memory, up to the last whole
  10251. row. You can then make more memory available and call the DBGetQueryResults
  10252. function again to retrieve more data. 
  10253.  
  10254. The DBGetQueryResults function can be used to retrieve the results of any query,
  10255. not only queries sent and executed by the DBStartQuery function.
  10256.  
  10257. The sessID parameter specifies the ID of the session from which you wish to
  10258. retrieve results. 
  10259. The results parameter is the results record, which contains a handle to the
  10260. retrieved data. Results records are described in “Getting Query Results” earlier
  10261. in this chapter.
  10262.  
  10263. The timeout parameter specifies the value that he DBGetQueryResults uses for the
  10264. timeout parameter each time it calls the DBGetItem function. The timeout
  10265. parameter specifies the maximum amount of time that the database extension
  10266. should wait to receive results from the database server before canceling the
  10267. DBGetItem function. Specify the timeout parameter in sixtieths of a second. To
  10268. disable the timeout feature, set the timeout parameter to the value
  10269. kDBWaitForever. This parameter is ignored if you specify a nonzero value for the
  10270. asyncPB parameter.
  10271.  
  10272. You can use the statusProc pointer to specify a pointer to a status routine that
  10273. you provide. The DBGetQueryResults function calls your status routine after it
  10274. calls the DBGetItem function to retrieve a data item. When it calls the status
  10275. routine, the DBGetQueryResults function provides the results of the DBGetItem
  10276. function, the data type, the data length, number of decimal places, and flags
  10277. associated with the data item, and a pointer to the data item. Status routines
  10278. are discussed in “Writing a Status Routine For High-Level Functions” earlier in
  10279. this chapter.
  10280.  
  10281. If you specify a pointer to an asynchronous parameter block in the asyncPB
  10282. parameter, the DBGetQueryResults function calls the DBGetItem function
  10283. asynchronously for each data item. As soon as the DBGetItem function has started
  10284. execution, it returns control to your application. Your application must then
  10285. call the WaitNextEvent routine periodically to allow this asynchronous routine
  10286. to run, and it must check the result field of the asynchronous parameter block
  10287. to determine when the routine has completed execution.
  10288.  
  10289. Result codes
  10290. noErr                 0  Query execution successful; no results returned
  10291. userCanceledErr    –128  Function canceled by status routine
  10292. rcDBValue          –801  Data available 
  10293. rcDBError          –802  Query execution ended in an error
  10294. rcDBBreak          –805  Function timed out
  10295. rcDBExec           –806  Query currently executing 
  10296. rcDBBadSessID      –807  Session ID is invalid
  10297. rcDBAsyncNotSupp   –811  The database extension does not support 
  10298.                          asynchronous calls
  10299. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10300.  
  10301. æKY DBResultsToText
  10302. æFp DatabaseAccess.p
  10303. æT FUNCTION
  10304. æTN A82F
  10305. æD FUNCTION DBResultsToText(results: ResultsRecord;VAR theText: Handle): OSErr;
  10306.     INLINE $303C,$0413,$A82F;
  10307. æDT myVariable := DBResultsToText(results,theText);
  10308. æC 
  10309. FUNCTION DBResultsToText (results: ResultsRecord; VAR theText: Handle) : OSErr;
  10310.  
  10311. The DBResultsToText function calls result handlers to convert to text the data
  10312. retrieved by the DBGetQueryResults function. Result handlers are described in 
  10313. “Converting Query Results to Text” earlier in this chapter.
  10314.  
  10315. The results parameter is the results record returned by the DBGetQueryResults
  10316. function. The parameter theText contains a handle to the converted text. This
  10317. handle is allocated by the Database Access Manager.
  10318.  
  10319. Result code
  10320. noErr                 0  No error
  10321. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10322.  
  10323. æKY DBInstallResultHandler
  10324. æFp DatabaseAccess.p
  10325. æT FUNCTION
  10326. æTN A82F
  10327. æD FUNCTION DBInstallResultHandler(dataType: DBType;theHandler: ProcPtr;isSysHandler: BOOLEAN): OSErr;
  10328.     INLINE $303C,$0514,$A82F;
  10329. æDT myVariable := DBInstallResultHandler(dataType,theHandler,isSysHandler);
  10330. æC 
  10331. FUNCTION DBInstallResultHandler (dataType: DBType; theHandler: ProcPtr; 
  10332.                                  isSysHandler: Boolean) : OSErr;
  10333.  
  10334. The DBInstallResultHandler function installs a result handler for the data type
  10335. specified by the dataType parameter. The result handler is then used by the
  10336. DBResultsToText function to convert data of the specified type into a character
  10337. string.
  10338.  
  10339. The parameter theHandler is a pointer to the result handler. The isSysHandler
  10340. parameter specifies whether the result handler is an application result
  10341. handler—to be used only when the DBResultsToText function is called by the
  10342. application that installed the result handler—or  a system result handler—to be
  10343. used by every application running on the system.
  10344.  
  10345. When you install an application result handler, it replaces any result handler
  10346. with the same name previously installed by that application. Similarly, when you
  10347. install a system result handler, it replaces any existing system result handler
  10348. with the same name. Before you temporarily replace an existing result handler,
  10349. use the DBGetResultHandler function to obtain a pointer to the present handler,
  10350. and save the present result handler in your application’s private storage. Then
  10351. you can reinstall the original result handler when you are finished using the
  10352. temporary one.
  10353.  
  10354. Because an application result handler is used in preference to a system result
  10355. handler if both are available, you can temporarily replace a system result
  10356. handler for purposes of your application by installing an application result
  10357. handler for the same data type. You can then use the DBRemoveResultHandler
  10358. function to remove the application result handler and return to using the system
  10359. result handler whenever you wish.
  10360.  
  10361. Result code
  10362. noErr                 0  No error
  10363. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10364.  
  10365. æKY DBRemoveResultHandler
  10366. æFp DatabaseAccess.p
  10367. æT FUNCTION
  10368. æTN A82F
  10369. æD FUNCTION DBRemoveResultHandler(dataType: DBType): OSErr;
  10370.     INLINE $303C,$0215,$A82F;
  10371. æDT myVariable := DBRemoveResultHandler(dataType);
  10372. æC 
  10373. FUNCTION DBRemoveResultHandler (dataType: DBType) : OSErr;
  10374.  
  10375. The DBRemoveResultHandler function removes from memory the application result
  10376. handler for the data type that you specify with the dataType parameter. This
  10377. function cannot remove a system result handler. 
  10378.  
  10379. Result codes
  10380. noErr                 0  No error
  10381. rcDBNoHandler      –813  There is no handler for this data type installed 
  10382.                          for the current application
  10383. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10384.  
  10385. æKY DBGetResultHandler
  10386. æFp DatabaseAccess.p
  10387. æT FUNCTION
  10388. æTN A82F
  10389. æD FUNCTION DBGetResultHandler(dataType: DBType;VAR theHandler: ProcPtr;getSysHandler: BOOLEAN): OSErr;
  10390.     INLINE $303C,$0516,$A82F;
  10391. æDT myVariable := DBGetResultHandler(dataType,theHandler,getSysHandler);
  10392. æC 
  10393. FUNCTION DBInstallResultHandler (dataType: DBType; theHandler: ProcPtr; 
  10394.                                  isSysHandler: Boolean) : OSErr;
  10395.  
  10396. The DBInstallResultHandler function installs a result handler for the data type
  10397. specified by the dataType parameter. The result handler is then used by the
  10398. DBResultsToText function to convert data of the specified type into a character
  10399. string.
  10400.  
  10401. The parameter theHandler is a pointer to the result handler. The isSysHandler
  10402. parameter specifies whether the result handler is an application result
  10403. handler—to be used only when the DBResultsToText function is called by the
  10404. application that installed the result handler—or  a system result handler—to be
  10405. used by every application running on the system.
  10406.  
  10407. When you install an application result handler, it replaces any result handler
  10408. with the same name previously installed by that application. Similarly, when you
  10409. install a system result handler, it replaces any existing system result handler
  10410. with the same name. Before you temporarily replace an existing result handler,
  10411. use the DBGetResultHandler function to obtain a pointer to the present handler,
  10412. and save the present result handler in your application’s private storage. Then
  10413. you can reinstall the original result handler when you are finished using the
  10414. temporary one.
  10415.  
  10416. Because an application result handler is used in preference to a system result
  10417. handler if both are available, you can temporarily replace a system result
  10418. handler for purposes of your application by installing an application result
  10419. handler for the same data type. You can then use the DBRemoveResultHandler
  10420. function to remove the application result handler and return to using the system
  10421. result handler whenever you wish.
  10422.  
  10423. Result code
  10424. noErr                 0  No error
  10425. rcDBPackNotInited  –815  The InitDBPack function has not yet been called
  10426.  
  10427.  
  10428.  
  10429. æKY DDEV.p
  10430. æKL 
  10431. DDEVFlags
  10432. DDEVParams
  10433. DDEVParamsPtr
  10434. kAsyncSupported
  10435. kDBBreak
  10436. kDBClose
  10437. kDBEnd
  10438. kDBExec
  10439. kDBGetConnInfo
  10440. kDBGetErr
  10441. kDBGetItem
  10442. kDBGetSessionNum
  10443. kDBIdle
  10444. kDBInit
  10445. kDBKill
  10446. kDBOpen
  10447. kDBSend
  10448. kDBSendItem
  10449. kDBState
  10450. kDBUnGetItem
  10451. kDDEVFlags
  10452. kDDEVID
  10453. kDDEVName
  10454.  
  10455. æKY kDBInit
  10456. æFp DDEV.p
  10457. æT CONST
  10458. æD 
  10459. {  messages for ddev  }
  10460.  
  10461. kDBInit = 0;
  10462. æC 
  10463.  
  10464. æKY kDBEnd
  10465. æFp DDEV.p
  10466. æT CONST
  10467. æD kDBEnd = 1;
  10468. æC 
  10469.  
  10470. æKY kDBGetConnInfo
  10471. æFp DDEV.p
  10472. æT CONST
  10473. æD kDBGetConnInfo = 2;
  10474. æC 
  10475.  
  10476. æKY kDBGetSessionNum
  10477. æFp DDEV.p
  10478. æT CONST
  10479. æD kDBGetSessionNum = 3;
  10480. æC 
  10481.  
  10482. æKY kDBSend
  10483. æFp DDEV.p
  10484. æT CONST
  10485. æD kDBSend = 4;
  10486. æC 
  10487.  
  10488. æKY kDBSendItem
  10489. æFp DDEV.p
  10490. æT CONST
  10491. æD kDBSendItem = 5;
  10492. æC 
  10493.  
  10494. æKY kDBExec
  10495. æFp DDEV.p
  10496. æT CONST
  10497. æD kDBExec = 6;
  10498. æC 
  10499.  
  10500. æKY kDBState
  10501. æFp DDEV.p
  10502. æT CONST
  10503. æD kDBState = 7;
  10504. æC 
  10505.  
  10506. æKY kDBGetErr
  10507. æFp DDEV.p
  10508. æT CONST
  10509. æD kDBGetErr = 8;
  10510. æC 
  10511.  
  10512. æKY kDBBreak
  10513. æFp DDEV.p
  10514. æT CONST
  10515. æD kDBBreak = 9;
  10516. æC 
  10517.  
  10518. æKY kDBGetItem
  10519. æFp DDEV.p
  10520. æT CONST
  10521. æD kDBGetItem = 10;
  10522. æC 
  10523.  
  10524. æKY kDBUnGetItem
  10525. æFp DDEV.p
  10526. æT CONST
  10527. æD kDBUnGetItem = 11;
  10528. æC 
  10529.  
  10530. æKY kDBKill
  10531. æFp DDEV.p
  10532. æT CONST
  10533. æD kDBKill = 12;
  10534. æC 
  10535.  
  10536. æKY kDBOpen
  10537. æFp DDEV.p
  10538. æT CONST
  10539. æD kDBOpen = 100;
  10540. æC 
  10541.  
  10542. æKY kDBClose
  10543. æFp DDEV.p
  10544. æT CONST
  10545. æD kDBClose = 101;
  10546. æC 
  10547.  
  10548. æKY kDBIdle
  10549. æFp DDEV.p
  10550. æT CONST
  10551. æD kDBIdle = 102;
  10552. æC 
  10553.  
  10554. æKY kDDEVName
  10555. æFp DDEV.p
  10556. æT CONST
  10557. æD 
  10558. {  resource IDs of misc. resources  }
  10559.  
  10560. kDDEVName = 128; { ID of 'STR ' resource with ddev name }
  10561. æC 
  10562.  
  10563. æKY kDDEVID
  10564. æFp DDEV.p
  10565. æT CONST
  10566. æD kDDEVID = 128; { ID of 'ddev' resource }
  10567. æC 
  10568.  
  10569. æKY kDDEVFlags
  10570. æFp DDEV.p
  10571. æT CONST
  10572. æD kDDEVFlags = 128; { ID of 'dflg' resource }
  10573. æC 
  10574.  
  10575. æKY kAsyncSupported
  10576. æFp DDEV.p
  10577. æT CONST
  10578. æD kAsyncSupported = $00000001; { bit for async support }
  10579. æC 
  10580.  
  10581. æKY DDEVFlags
  10582. æFp DDEV.p
  10583. æT RECORD
  10584. æD DDEVFlags = RECORD
  10585.     version: LONGINT; { always 0 for this release }
  10586.     flags: LONGINT; { flags }
  10587.     END;
  10588. æC 
  10589.  
  10590. æKY DDEVParams
  10591. DDEVParamsPtr
  10592. æFp DDEV.p
  10593. æT RECORD
  10594. æD DDEVParamsPtr = ^DDEVParams;
  10595. DDEVParams = RECORD
  10596.     message: INTEGER; { action for ddev }
  10597.     ddevStorage: LONGINT; { storage for ddev }
  10598.     asyncPB: DBAsyncParmBlkPtr; { async parameter block pointer }
  10599.     sessID: LONGINT; { session ID }
  10600.     returnedID: LONGINT; { session ID returned by DBGetConnInfo }
  10601.     version: LONGINT; { version returned by DBGetConnInfo }
  10602.     start: LONGINT; { start returned by DBGetConnInfo }
  10603.     host: StringPtr; { host for DBInit and DBGetConnInfo }
  10604.     user: StringPtr; { user for DBInit and DBGetConnInfo }
  10605.     password: StringPtr; { password for DBInit and DBGetConnInfo }
  10606.     connStr: StringPtr; { connection string for DBInit and DBGetConnInfo }
  10607.     network: StringPtr; { network for DBInit and DBGetConnInfo }
  10608.     buffer: Ptr; { buffer used in several calls }
  10609.     err1: LONGINT; { error 1 for DGGetErr }
  10610.     err2: LONGINT; { error 2 for DGGetErr }
  10611.     item1: StringPtr; { item 1 for DGGetErr }
  10612.     item2: StringPtr; { item 2 for DGGetErr }
  10613.     errorMsg: StringPtr; { errorMsg for DGGetErr }
  10614.     timeout: LONGINT; { timeout for DGGetItem}
  10615.     dataType: DBType; { type for several calls }
  10616.     sessNum: INTEGER; { session number for DBGetConnInfo and DBGetSessionNum}
  10617.     state: INTEGER; { state for DBGetConnInfo }
  10618.     len: INTEGER; { length of buffer }
  10619.     places: INTEGER; { places for DBSendItem and DBGetItem }
  10620.     flags: INTEGER; { flags for DBSendItem and DBGetItem }
  10621.     abort: BOOLEAN; { abort for DBBreak }
  10622.     END;
  10623. æC 
  10624.  
  10625.  
  10626. æKY Desk.p
  10627. æKL CloseDeskAcc
  10628. OpenDeskAcc
  10629. SystemClick
  10630. SystemEdit
  10631. SystemEvent
  10632. SystemMenu
  10633. SystemTask
  10634.  
  10635. accClear
  10636. accCopy
  10637. accCursor
  10638. accCut
  10639. accEvent
  10640. accMenu
  10641. accPaste
  10642. accRun
  10643. accUndo
  10644. goodbye
  10645.  
  10646. æKY accEvent
  10647. æFp Desk.p
  10648. æT CONST
  10649. æD accEvent = 64;
  10650. æC 
  10651.  
  10652. æKY accRun
  10653. æFp Desk.p
  10654. æT CONST
  10655. æD accRun = 65;
  10656. æC 
  10657.  
  10658. æKY accCursor
  10659. æFp Desk.p
  10660. æT CONST
  10661. æD accCursor = 66;
  10662. æC 
  10663.  
  10664. æKY accMenu
  10665. æFp Desk.p
  10666. æT CONST
  10667. æD accMenu = 67;
  10668. æC 
  10669.  
  10670. æKY accUndo
  10671. æFp Desk.p
  10672. æT CONST
  10673. æD accUndo = 68;
  10674. æC 
  10675.  
  10676. æKY accCut
  10677. æFp Desk.p
  10678. æT CONST
  10679. æD accCut = 70;
  10680. æC 
  10681.  
  10682. æKY accCopy
  10683. æFp Desk.p
  10684. æT CONST
  10685. æD accCopy = 71;
  10686. æC 
  10687.  
  10688. æKY accPaste
  10689. æFp Desk.p
  10690. æT CONST
  10691. æD accPaste = 72;
  10692. æC 
  10693.  
  10694. æKY accClear
  10695. æFp Desk.p
  10696. æT CONST
  10697. æD accClear = 73;
  10698. æC 
  10699.  
  10700. æKY goodbye
  10701. æFp Desk.p
  10702. æT CONST
  10703. æD goodbye = -1; {goodbye message}
  10704. æC 
  10705.  
  10706. æKY OpenDeskAcc
  10707. æFp Desk.p
  10708. æT FUNCTION
  10709. æTN A9B6
  10710. æD FUNCTION OpenDeskAcc(theAcc: Str255): INTEGER;
  10711.     INLINE $A9B6;
  10712. æDT myVariable := OpenDeskAcc(theAcc);
  10713. æMM
  10714. æRI I-440
  10715. æC 
  10716. OpenDeskAcc opens the desk accessory having the given name and displays its window
  10717. (if any) as the active window. The name is the accessory’s resource name, which you
  10718. get from the Apple menu by calling the Menu Manager procedure GetItem. OpenDeskAcc
  10719. calls the Resource Manager to read the desk accessory from the resource file into the
  10720. application heap.
  10721.  
  10722. You should ignore the value returned by OpenDeskAcc. If the desk accessory is successfully
  10723. opened, the function result is its driver reference number. However, if the desk
  10724. accessory can’t be opened, the function result is undefined; the accessory will have
  10725. taken care of informing the user of the problem (such as memory full) and won’t
  10726. display itself.
  10727.  
  10728. Warning:  Early versions of some desk accessories may set the current
  10729.           grafPort to the accessory’s port upon return from OpenDeskAcc.
  10730.           To be safe, you should bracket your call to OpenDeskAcc with
  10731.           calls to the QuickDraw procedures GetPort and SetPort, to save
  10732.           and restore the current port.
  10733.  
  10734. Note:  Programmers concerned about the amount of available memory should
  10735.        be aware that an open desk accessory uses from 1K to 3K bytes of
  10736.        heap space in addition to the space needed for the accessory itself.
  10737.        The desk accessory is responsible for determining whether there is
  10738.        sufficient memory for it to run; this can be done by calling
  10739.        SizeResource followed by ResrvMem.
  10740.  
  10741. æKY CloseDeskAcc
  10742. æFp Desk.p
  10743. æT PROCEDURE
  10744. æTN A9B7
  10745. æD PROCEDURE CloseDeskAcc(refNum: INTEGER);
  10746.     INLINE $A9B7;
  10747. æDT CloseDeskAcc(refNum);
  10748. æRI I-440
  10749. æC 
  10750. When a system window is active and the user chooses Close from the File menu, call
  10751. CloseDeskAcc to close the desk accessory. RefNum is the driver reference number for
  10752. the desk accessory, which you get from the windowKind field of its window.
  10753.  
  10754. The Desk Manager automatically closes a desk accessory if the user clicks its close
  10755. box. Also, since the application heap is released when the application terminates,
  10756. every desk accessory goes away at that time.
  10757.  
  10758. æKY SystemClick
  10759. æFp Desk.p
  10760. æT PROCEDURE
  10761. æTN A9B3
  10762. æD PROCEDURE SystemClick(theEvent: EventRecord;theWindow: WindowPtr);
  10763.     INLINE $A9B3;
  10764. æDT SystemClick(theEvent,theWindow);
  10765. æMM
  10766. æRI I-441, P-35, 182
  10767. æC 
  10768. When a mouse-down event occurs and the Window Manager function FindWindow reports
  10769. that the mouse button was pressed in a system window, the application should call
  10770. SystemClick with the event record and the window pointer. If the given window belongs
  10771. to a desk accessory, SystemClick sees that the event gets handled properly.
  10772.  
  10773. SystemClick determines which part of the desk accessory’s window the mouse button was
  10774. pressed in, and responds accordingly (similar to the way your application responds to
  10775. mouse activities in its own windows).
  10776.  
  10777.   •  If the mouse button was pressed in the content region of the window
  10778.      and the window was active, SystemClick sends the mouse-down event to
  10779.      the desk accessory, which processes it as appropriate.
  10780.   •  If the mouse button was pressed in the content region and the window
  10781.      was inactive, SystemClick makes it the active window.
  10782.   •  If the mouse button was pressed in the drag region, SystemClick calls
  10783.      the Window Manager procedure DragWindow to pull an outline of the window
  10784.      across the screen and move the window to a new location. If the window
  10785.      was inactive, DragWindow also makes it the active window (unless the
  10786.      Command key was pressed along with the mouse button).
  10787.   •  If the mouse button was pressed in the go-away region, SystemClick calls
  10788.      the Window Manager function TrackGoAway to determine whether the mouse
  10789.      is still inside the go-away region when the click is completed:  If
  10790.      so, it tells the desk accessory to close itself; otherwise, it does
  10791.      nothing.
  10792.  
  10793. æKY SystemEdit
  10794. æFp Desk.p
  10795. æT FUNCTION
  10796. æTN A9C2
  10797. æD FUNCTION SystemEdit(editCmd: INTEGER): BOOLEAN;
  10798.     INLINE $A9C2;
  10799. æDT myVariable := SystemEdit(editCmd);
  10800. æMM
  10801. æRT 180, 215
  10802. æRI I-441
  10803. æC 
  10804. Assembly-language note:  The macro you invoke to call SystemEdit from
  10805.                          assembly language is named _SysEdit.
  10806.  
  10807. Call SystemEdit when there’s a mouse-down event in the menu bar and the user chooses
  10808. one of the five standard editing commands from the Edit menu. Pass one of the following
  10809. as the value of the editCmd parameter:
  10810.  
  10811.   editCmd    Editing command
  10812.  
  10813.     0            Undo
  10814.     2            Cut
  10815.     3            Copy
  10816.     4            Paste
  10817.     5            Clear
  10818.  
  10819. If your Edit menu contains these five commands in the standard arrangement (the order
  10820. listed above, with a dividing line between Undo and Cut), you can simply call
  10821.  
  10822.   SystemEdit(menuItem-1)
  10823.  
  10824. where menuItem is the menu item number.
  10825.  
  10826. If the active window doesn’t belong to a desk accessory, SystemEdit returns FALSE;
  10827. the application should then process the editing command as usual. If the active
  10828. window does belong to a desk accessory, SystemEdit asks that accessory to process the
  10829. command and returns TRUE; in this case, the application should ignore the command.
  10830.  
  10831. Note:  It’s up to the application to make sure desk accessories get
  10832.        their editing commands that are chosen from the Edit menu. In
  10833.        particular, make sure your application hasn’t disabled the Edit
  10834.        menu or any of the five standard commands when a desk accessory
  10835.        is activated.
  10836.  
  10837. æKY SystemTask
  10838. æFp Desk.p
  10839. æT PROCEDURE
  10840. æTN A9B4
  10841. æD PROCEDURE SystemTask;
  10842.     INLINE $A9B4;
  10843. æDT SystemTask(paramList);
  10844. æRT 85
  10845. æRI I-442, 444, II-189, N85-1
  10846. æC 
  10847. For each open desk accessory (or other device driver performing periodic actions),
  10848. SystemTask causes the accessory to perform the periodic action defined for it, if any
  10849. such action has been defined and if the proper time period has passed since the
  10850. action was last performed. For example, a clock accessory can be defined such that
  10851. the second hand is to move once every second; the periodic action for the accessory
  10852. will be to move the second hand to the next position, and SystemTask will alert the
  10853. accessory every second to perform that action.
  10854.  
  10855. You should call SystemTask as often as possible, usually once every time through your
  10856. main event loop. Call it more than once if your application does an unusually large
  10857. amount of processing each time through the loop.
  10858.  
  10859. Note:  SystemTask should be called at least every sixtieth of a second.
  10860.  
  10861. æKY SystemEvent
  10862. æFp Desk.p
  10863. æT FUNCTION
  10864. æTN A9B2
  10865. æD FUNCTION SystemEvent(theEvent: EventRecord): BOOLEAN;
  10866.     INLINE $A9B2;
  10867. æDT myVariable := SystemEvent(theEvent);
  10868. æRT 5,85
  10869. æRI I-442, N5-1, N85-1
  10870. æC  
  10871. SystemEvent is called only by the Toolbox Event Manager function GetNextEvent when it
  10872. receives an event, to determine whether the event should be handled by the application
  10873. or by the system. If the given event should be handled by the application, SystemEvent
  10874. returns FALSE; otherwise, it calls the appropriate system code to handle the event
  10875. and returns TRUE.
  10876.  
  10877. In the case of a null or mouse-down event, SystemEvent does nothing but return FALSE.
  10878. Notice that it responds this way to a mouse-down event even though the event may in
  10879. fact have occurred in a system window (and therefore may have to be handled by the
  10880. system). The reason for this is that the check for exactly where the event occurred
  10881. (via the Window Manager function FindWindow) is made later by the application and so
  10882. would be made twice if SystemEvent were also to do it. To avoid this duplication,
  10883. SystemEvent passes the event on to the application and lets it make the sole call to
  10884. FindWindow. Should FindWindow reveal that the mouse-down event did occur in a system
  10885. window, the application can then call SystemClick, as described above, to get the
  10886. system to handle it.
  10887.  
  10888. If the given event is a mouse-up or any keyboard event (including keyboard equivalents
  10889. of commands), SystemEvent checks whether the active window belongs to a desk accessory
  10890. and whether that accessory can handle this type of event. If so, it sends the event
  10891. to the desk accessory and returns TRUE; otherwise, it returns FALSE.
  10892.  
  10893. If SystemEvent is passed an activate or update event, it checks whether the window
  10894. the event occurred in is a system window belonging to a desk accessory and whether
  10895. that accessory can handle this type of event. If so, it sends the event to the desk
  10896. accessory and returns TRUE; otherwise, it returns FALSE.
  10897.  
  10898. Note:  It’s unlikely that a desk accessory would not be set up to handle
  10899.        keyboard, activate, and update events, or that it would handle
  10900.        mouse-up events.
  10901.  
  10902.        If the given event is a disk-inserted event, SystemEvent does some
  10903.        low-level processing (by calling the File Manager function MountVol)
  10904.        but passes the event on to the application by returning FALSE, in
  10905.        case the application wants to do further processing. Finally,
  10906.        SystemEvent returns FALSE for network, device driver, and
  10907.        application-defined events.
  10908.  
  10909. Assembly-language note:  Advanced programmers can make SystemEvent
  10910.                          always return FALSE by setting the global
  10911.                          variable SEvtEnb (a byte) to 0.
  10912.  
  10913. æKY SystemMenu
  10914. æFp Desk.p
  10915. æT PROCEDURE
  10916. æTN A9B5
  10917. æD PROCEDURE SystemMenu(menuResult: LONGINT);
  10918.     INLINE $A9B5;
  10919. æDT SystemMenu(menuResult);
  10920. æMM
  10921. æRI I-443
  10922. æC  
  10923. SystemMenu is called only by the Menu Manager functions MenuSelect and MenuKey, when
  10924. an item in a menu belonging to a desk accessory has been chosen. The menuResult
  10925. parameter has the same format as the value returned by MenuSelect and MenuKey:  the
  10926. menu ID in the high-order word and the menu item number in the low-order word. (The
  10927. menu ID will be negative.) SystemMenu directs the desk accessory to perform the
  10928. appropriate action for the given menu item.
  10929.  
  10930.  
  10931. æKY DeskBus.p
  10932. æKL ADBOp
  10933. ADBReInit
  10934. CountADBs
  10935. GetADBInfo
  10936. GetIndADB
  10937. SetADBInfo
  10938.  
  10939. ADBAddress
  10940. ADBDataBlock
  10941. ADBDBlkPtr
  10942. ADBOpBlock
  10943. ADBOpBPtr
  10944. ADBSetInfoBlock
  10945. ADBSInfoPtr
  10946.  
  10947. æKY ADBOpBlock
  10948. ADBOpBPtr
  10949. æFp DeskBus.p
  10950. æT RECORD
  10951. æD ADBOpBPtr = ^ADBOpBlock;
  10952. ADBOpBlock = RECORD
  10953.     dataBuffPtr: Ptr; {address of data buffer}
  10954.     opServiceRtPtr: Ptr; {service routine pointer}
  10955.     opDataAreaPtr: Ptr; {optional data area address}
  10956.     END;
  10957. æC 
  10958.  
  10959. æKY ADBDataBlock
  10960. ADBDBlkPtr
  10961. æFp DeskBus.p
  10962. æT RECORD
  10963. æD ADBDBlkPtr = ^ADBDataBlock;
  10964. ADBDataBlock = PACKED RECORD
  10965.     devType: SignedByte; {device type}
  10966.     origADBAddr: SignedByte; {original ADB Address}
  10967.     dbServiceRtPtr: Ptr; {service routine pointer}
  10968.     dbDataAreaAddr: Ptr; {data area address}
  10969.     END;
  10970. æC 
  10971.  
  10972. æKY ADBSetInfoBlock
  10973. ADBSInfoPtr
  10974. æFp DeskBus.p
  10975. æT RECORD
  10976. æD ADBSInfoPtr = ^ADBSetInfoBlock;
  10977. ADBSetInfoBlock = RECORD
  10978.     siServiceRtPtr: Ptr; {service routine pointer}
  10979.     siDataAreaAddr: Ptr; {data area address}
  10980.     END;
  10981. æC 
  10982.  
  10983. æKY ADBAddress
  10984. æFp DeskBus.p
  10985. æT RECORD
  10986. æD ADBAddress = SignedByte;
  10987. æC 
  10988.  
  10989. æKY ADBReInit
  10990. æFp DeskBus.p
  10991. æT PROCEDURE
  10992. æTN A07B
  10993. æD PROCEDURE ADBReInit;
  10994.     INLINE $A07B;
  10995. æDT ADBReInit(paramList);
  10996. æMM
  10997. æRT 143, 206 
  10998. æRI V-367, N143
  10999. æC 
  11000. Trap macro    _ADBReInit
  11001.  
  11002. ADBReInit reinitializes the entire Apple Desktop Bus. It clears the ADB device table
  11003. to zeros and places a SendReset command on the bus to reset all devices to their
  11004. original addresses. ADBReInit has no parameters.
  11005.  
  11006. Because it does not deallocate ADB resources on the system heap, ADBReInit should not
  11007. be used for routine bus initialization. Apple strongly recommends against adding
  11008. devices while the system is running; therefore, you should never call ADBReInit.
  11009.  
  11010. ADBReInit also calls a routine pointed to by the low memory global JADBProc
  11011. at the beginning and end of its execution.  You can insert your own
  11012. preprocessing/postprocessing routine by changing the value of JADBProc; ADBReInit
  11013. conditions it by setting D0 to 0 for preprocessing and to 1 for postprocessing.  Your
  11014. procedure must restore the value of D0 and branch to the original value of JADBProc
  11015. on exit.  JADBProc should be used to de-allocate memory used by the driver (see
  11016. MacDTS Sample Code “TbltDrvr” for an example), and then it should chain to the procedure
  11017. originally found in JADBProc.
  11018.  
  11019. The complete ADBReInit sequence is therefore the following:
  11020.  
  11021.   •  JSR to JADBProc with D0 set to 0
  11022.   •  reinitialize the Apple Desktop Bus
  11023.   •  clear the ADB device table
  11024.   •  JSR to JADBProc with D0 set to 1
  11025.  
  11026. æKY ADBOp
  11027. æFp DeskBus.p
  11028. æT FUNCTION
  11029. æD FUNCTION ADBOp(data: Ptr;compRout: ProcPtr;buffer: Ptr;commandNum: INTEGER): OSErr;
  11030. æDT myVariable := ADBOp(data,compRout,buffer,commandNum);
  11031. æRT 206
  11032. æRI V-368
  11033. æC 
  11034. Trap macro    _ADBOp
  11035.  
  11036. On entry:    A0:  pointer to parameter block
  11037.              D0:  commandNum (byte)
  11038.  
  11039. Parameter block
  11040.     -->    0    buffer      pointer
  11041.     -->    4    compRout    pointer
  11042.     -->    8    data        pointer
  11043.  
  11044. On exit:     D0:  result code (byte)
  11045.  
  11046. The completion routine pointed to by compRout will be passed the following parameters
  11047. on entry:
  11048.  
  11049.              D0:  commandNum (byte)
  11050.              A0:  pointer to buffer, data stored as a Pascal string (maximum
  11051.                   8 bytes data preceded by one length byte)
  11052.              A1:  pointer to completion routine (compRout)
  11053.              A2:  pointer to optional data area (data)
  11054.  
  11055. ADBOp transmits over the bus the command byte whose value is given by commandNum. The
  11056. structure of the command byte is given earlier in Figure 1. ADBOp executes only when
  11057. the ADB is otherwise idle; otherwise it is held in a command queue. It returns an
  11058. error if the command queue is full. The length of the data buffer pointed to by
  11059. buffer is contained in its first byte, like a Pascal string. The optional data area
  11060. pointed to by data is for local storage by the completion routine pointed to by
  11061. compRout. ADBop should be used sparingly; it is not intended for polling a device. 
  11062. The host automatically polls devices with data to deliver.
  11063.  
  11064. Result codes    noErr    No error
  11065.                 –1       Unsuccessful completion
  11066.  
  11067. æKY CountADBs
  11068. æFp DeskBus.p
  11069. æT FUNCTION
  11070. æD FUNCTION CountADBs: INTEGER;
  11071. æDT myVariable := CountADBs(paramList);
  11072. æRT 206
  11073. æRI V-369
  11074. æC 
  11075. Trap macro    _CountADBs
  11076.  
  11077. On exit:    D0:  number of devices (byte)
  11078.  
  11079. CountADBs returns a value representing the number of devices connected to the ADB by
  11080. counting the number of entries in the device table. It has no arguments and returns
  11081. no error codes.
  11082.  
  11083. æKY GetIndADB
  11084. æFp DeskBus.p
  11085. æT FUNCTION
  11086. æD FUNCTION GetIndADB(VAR info: ADBDataBlock;devTableIndex: INTEGER): ADBAddress;
  11087. æDT myVariable := GetIndADB(info,devTableIndex);
  11088. æRT 206
  11089. æRI V-369
  11090. æC 
  11091. Trap macro    _GetIndADB
  11092.  
  11093. On entry:    A0:  pointer to parameter block
  11094.              D0:  entry index number; range = 1..CountADBs (byte)
  11095.  
  11096. Parameter block
  11097.     <--    0    device type                byte    (handler ID)
  11098.     <--    1    original ADB address       byte
  11099.     <--    2    service routine address    pointer (compRout)
  11100.     <--    6    data area address          pointer (data)
  11101.  
  11102. On exit:     D0:  positive value:  current ADB address (byte)
  11103.                   negative value:  error code (byte)
  11104.  
  11105. GetIndADB returns information from the ADB device table entry whose index number is
  11106. given by devTableIndex. ADBDataBlock has this form:
  11107.  
  11108. TYPE  ADBDataBlock =
  11109.              PACKED RECORD
  11110.                devType:         SignedByte; {device type (handler ID)}
  11111.                origADBAddr:     SignedByte; {original ADB address}
  11112.                dbServiceRtPtr:  Ptr;        {service routine address (compRout)}
  11113.                dbDataAreaAddr:  Ptr         {data area address (data)}
  11114.              END;
  11115.  
  11116. GetIndADB returns the current ADB address of the device. If it is unable to complete
  11117. execution successfully, GetIndADB returns a negative value.
  11118.  
  11119. æKY GetADBInfo
  11120. æFp DeskBus.p
  11121. æT FUNCTION
  11122. æD FUNCTION GetADBInfo(VAR info: ADBDataBlock;adbAddr: ADBAddress): OSErr;
  11123. æDT myVariable := GetADBInfo(info,adbAddr);
  11124. æRI V-370
  11125. æC 
  11126. Trap macro    _GetADBInfo
  11127.  
  11128. On entry:    A0:  pointer to parameter block
  11129.              D0:  ADB address of the device (byte)
  11130.  
  11131. Parameter block
  11132.     <--    0    device handler ID          byte
  11133.     <--    1    original ADB address       byte
  11134.     <--    2    service routine address    pointer (compRout)
  11135.     <--    6    data area address          pointer (data)
  11136.  
  11137. On exit:     D0:  result code (byte)
  11138.  
  11139. GetADBInfo returns information from the ADB device table entry of the device whose
  11140. ADB address is given by ABDAddr. The structure of ADBDataBlock is given above under
  11141. “GetIndADB”.
  11142.  
  11143. Result codes    noErr    No error
  11144.  
  11145. æKY SetADBInfo
  11146. æFp DeskBus.p
  11147. æT FUNCTION
  11148. æD FUNCTION SetADBInfo(VAR info: ADBSetInfoBlock;adbAddr: ADBAddress): OSErr;
  11149. æDT myVariable := SetADBInfo(info,adbAddr);
  11150. æRT 206
  11151. æRI V-370
  11152. æC 
  11153. Trap macro    _SetADBInfo
  11154.  
  11155. On entry:    A0:  pointer to parameter block
  11156.              D0:  ADB address of the device (byte)
  11157.  
  11158. Parameter block
  11159.     -->    0    service routine address    pointer (compRout)
  11160.     -->    4    data area address          pointer (data)
  11161.  
  11162. On exit:     D0:  result code (byte)
  11163.  
  11164. SetADBInfo sets the service routine address and the data area address in the ADB
  11165. device table entry for the device whose ADB address is given by ABDAddr. ADBSetInfoBlock
  11166. has this form:
  11167.  
  11168. TYPE  ADBSetInfoBlock =
  11169.                RECORD
  11170.                  siServiceRtPtr:  Ptr;  {service routine address (compRout)}
  11171.                  siDataAreaAddr:  Ptr   {data area address (data)}
  11172.                END;
  11173.  
  11174. Result codes    noErr    No error
  11175.  
  11176. Warning:  You should send a Flush command to the device after calling it
  11177.           with SetADBInfo, to prevent it sending old data to the new data
  11178.           area address.
  11179.  
  11180.  
  11181. æKY Devices.p
  11182. æKL CloseDriver
  11183. Control
  11184. GetDCtlEntry
  11185. KillIO
  11186. OpenDriver
  11187. PBControl
  11188. PBKillIO
  11189. PBStatus
  11190. SetChooserAlert
  11191. Status
  11192.  
  11193. activDev
  11194. AuxDCE
  11195. AuxDCEHandle
  11196. AuxDCEPtr
  11197. buttonMsg
  11198. cdevGenErr
  11199. cdevMemErr
  11200. cdevResErr
  11201. cdevUnset
  11202. chooserID
  11203. clearDev
  11204. closeDev
  11205. copyDev
  11206. cursorDev
  11207. cutDev
  11208. DCtlEntry
  11209. DCtlHandle
  11210. DCtlPtr
  11211. deactivDev
  11212. deselectMsg
  11213. fillListMsg
  11214. getSelMsg
  11215. hitDev
  11216. initDev
  11217. keyEvtDev
  11218. macDev
  11219. newSelMsg
  11220. nulDev
  11221. pasteDev
  11222. selectMsg
  11223. terminateMsg
  11224. undoDev
  11225. updateDev
  11226.  
  11227. æKY newSelMsg
  11228. æFp Devices.p
  11229. æT CONST
  11230. æD newSelMsg = 12;
  11231. æC 
  11232.  
  11233. æKY fillListMsg
  11234. æFp Devices.p
  11235. æT CONST
  11236. æD fillListMsg = 13;
  11237. æC 
  11238.  
  11239. æKY getSelMsg
  11240. æFp Devices.p
  11241. æT CONST
  11242. æD getSelMsg = 14;
  11243. æC 
  11244.  
  11245. æKY selectMsg
  11246. æFp Devices.p
  11247. æT CONST
  11248. æD selectMsg = 15;
  11249. æC 
  11250.  
  11251. æKY deselectMsg
  11252. æFp Devices.p
  11253. æT CONST
  11254. æD deselectMsg = 16;
  11255. æC 
  11256.  
  11257. æKY terminateMsg
  11258. æFp Devices.p
  11259. æT CONST
  11260. æD terminateMsg = 17;
  11261. æC 
  11262.  
  11263. æKY buttonMsg
  11264. æFp Devices.p
  11265. æT CONST
  11266. æD buttonMsg = 19;
  11267. æC 
  11268.  
  11269. æKY chooserID
  11270. æFp Devices.p
  11271. æT CONST
  11272. æD chooserID = 1;
  11273. æC 
  11274.  
  11275. æKY initDev
  11276. æFp Devices.p
  11277. æT CONST
  11278. æD initDev = 0; {Time for cdev to initialize itself}
  11279. æC »The initDev Message
  11280.  
  11281. InitDev is an initialization message sent to allow the cdev to allocate its private
  11282. storage (if any) and do any initial settings to buttons or controls.  This message is
  11283. sent when the user clicks on the cdev’s icon.
  11284.  
  11285. Note that the dialog, cdev list, and all of the items in the cdev’s 'DITL' except
  11286. user items will already have been drawn when the initDev message is sent.
  11287.  
  11288. If your cdev doesn’t need any storage it should return the value that was passed to
  11289. it in cdevValue.
  11290.  
  11291. æKY hitDev
  11292. æFp Devices.p
  11293. æT CONST
  11294. æD hitDev = 1; {Hit on one of my items}
  11295. æC »The hitDev Message
  11296.  
  11297. A hitDev message is sent when the user has clicked an enabled dialog item that belongs
  11298. to the cdev.  The dialog item number of the item hit is passed in the Item parameter.
  11299.  Remember that the Control Panel’s items precede yours, so
  11300. you’ll want (Item – numItems) to determine which of your items was hit.  If the
  11301. Control Panel itself has n items, the first of the cdev’s items will be n+1 in the
  11302. combined dialog item list.  A cdev should not depend on any hardcoded value for
  11303. numItems, since the number of items in Control Panel’s 'DITL' is likely to change in
  11304. the future.
  11305.  
  11306. Factoring in numItems need not mean an increase in your code size, or passing and
  11307. adding numItems everywhere, or foregoing the constants that most developers use to
  11308. identify specific items.  You can do it easily, and neatly, as follows:
  11309.  
  11310.   1.  Subtract numItems from Item right away, and refer to your dialog
  11311.       items with constants as usual throughout the cdev.
  11312.   2.  Write simple envelope routines to enclose Dialog Manager procedures
  11313.       that require item number arguments.  Add numItems only locally,
  11314.       within those routines and for the Dialog Manager calls only.
  11315.  
  11316. This is demonstrated in the sample cdev.
  11317.  
  11318. æKY closeDev
  11319. æFp Devices.p
  11320. æT CONST
  11321. æD closeDev = 2; {Close yourself}
  11322. æC »The closeDev Message
  11323.  
  11324. A closeDev message is sent to the cdev when either the Control Panel is closed or the
  11325. user selects another cdev.  When a cdev receives a closeDev message it should dispose
  11326. of any storage it has allocated, including the handle stored in cdevValue, if any.
  11327.  
  11328. æKY nulDev
  11329. æFp Devices.p
  11330. æT CONST
  11331. æD nulDev = 3; {Null event}
  11332. æC »The nulDev Message
  11333.  
  11334. A nulDev message is sent to the cdev on every Control Panel run event.  This allows
  11335. the cdev to perform tasks that need to be executed continuously
  11336. (insertion point blinking, for example).
  11337.  
  11338. A cdev cannot assume any particular timing of calls from applications.  Don’t use
  11339. nulDev to refresh settings; see activDev, above.
  11340.  
  11341. æKY updateDev
  11342. æFp Devices.p
  11343. æT CONST
  11344. æD updateDev = 4; {Update event}
  11345. æC »The updateDev Message
  11346.  
  11347. An updateDev message is sent to the cdev on every update event.  It allows the cdev
  11348. to perform any updating necessary aside from the standard dialog item updating provided
  11349. by the Dialog Manager.  For example, if the cdev resource contains a picture of the
  11350. sound control bar, it will probably be a user item, and the picture of the control
  11351. bar and the volume knob should be redrawn in response to update events.
  11352.  
  11353. Note that there is no mechanism for determining what to update, as the update region
  11354. has already been reset.  You must redraw all of your user items completely.
  11355.  
  11356. æKY activDev
  11357. æFp Devices.p
  11358. æT CONST
  11359. æD activDev = 5; {Activate event}
  11360. æC »The activDev Message
  11361.  
  11362. An activDev message is sent to the cdev on every activate event.  It allows the cdev
  11363. to reset any items that may have changed while the Control Panel was inactive.   It
  11364. also allows the cdev to send things such as “lists activate” messages.
  11365.  
  11366. æKY deactivDev
  11367. æFp Devices.p
  11368. æT CONST
  11369. æD deactivDev = 6; {Deactivate event}
  11370. æC »The deActivDev Message
  11371.  
  11372. A deActivDev message is sent to the cdev on every deactivate event.  It allows the
  11373. cdev to send deactivate messages to items such as lists.
  11374.  
  11375. æKY keyEvtDev
  11376. æFp Devices.p
  11377. æT CONST
  11378. æD keyEvtDev = 7; {Key down/auto key}
  11379. æC »The keyEvtDev Message
  11380.  
  11381. A keyEvtDev message is sent to the cdev on every keyDown event and autoKey event.  It
  11382. allows the cdev to process key events.  On return to the Control Panel, the key event
  11383. will be processed by a call to dialogSelect in the Dialog Manager.  A cdev that does
  11384. not want the Toolbox Event Manager to do any further processing should change the
  11385. what field of the EventRecord to nullEvent before returning to the Control Panel.
  11386.  
  11387. æKY macDev
  11388. æFp Devices.p
  11389. æT CONST
  11390. æD macDev = 8; {Decide whether or not to show up}
  11391. æC »The macDev Message
  11392.  
  11393. If the 'mach' resource has a 0 in Softmask and a –1 ($FFFF) in Hardmask, the first
  11394. message a cdev will get is a macDev message.  This is an opportunity for the cdev to
  11395. determine whether it can run, and whether it should appear in the Control Panel’s
  11396. cdev list.  The cdev can do its own check to see which machine it is being run on,
  11397. what hardware is connected, and what is in the slots (if it has slots).  The cdev
  11398. must then return a function result of 1 or 0.  If  a 0 is returned, the Control Panel
  11399. will not display the cdev in the icon list.  (Note that the Control Panel does not
  11400. interpret this 0 or 1 as an error message as described under “Cdev Error Checking”.)
  11401.  
  11402. The macDev call happens only once, and only when Softmask and Hardmask are 0 and
  11403. FFFF.  It is always the first call made to the cdev.
  11404.  
  11405. æKY undoDev
  11406. æFp Devices.p
  11407. æT CONST
  11408. æD undoDev = 9;
  11409. æC 
  11410.  
  11411. æKY cutDev
  11412. æFp Devices.p
  11413. æT CONST
  11414. æD cutDev = 10;
  11415. æC 
  11416.  
  11417. æKY copyDev
  11418. æFp Devices.p
  11419. æT CONST
  11420. æD copyDev = 11;
  11421. æC 
  11422.  
  11423. æKY pasteDev
  11424. æFp Devices.p
  11425. æT CONST
  11426. æD pasteDev = 12;
  11427. æC 
  11428.  
  11429. æKY clearDev
  11430. æFp Devices.p
  11431. æT CONST
  11432. æD clearDev = 13;
  11433. æC 
  11434.  
  11435. æKY cursorDev
  11436. æFp Devices.p
  11437. æT CONST
  11438. æD cursorDev = 14;
  11439. æC 
  11440.  
  11441. æKY cdevGenErr
  11442. æFp Devices.p
  11443. æT CONST
  11444. æD cdevGenErr = -1; {General error; gray cdev w/o alert}
  11445. æC 
  11446.  
  11447. æKY cdevMemErr
  11448. æFp Devices.p
  11449. æT CONST
  11450. æD cdevMemErr = 0; {Memory shortfall; alert user please}
  11451. æC 
  11452.  
  11453. æKY cdevResErr
  11454. æFp Devices.p
  11455. æT CONST
  11456. æD cdevResErr = 1; {Couldn't get a needed resource; alert}
  11457. æC 
  11458.  
  11459. æKY cdevUnset
  11460. æFp Devices.p
  11461. æT CONST
  11462. æD cdevUnset = 3; { cdevValue is initialized to this}
  11463. æC 
  11464. »CDEV ERROR CHECKING
  11465. _______________________________________________________________________________
  11466.  
  11467. Because a desk accessory may be called into many strange and wonderful situations,
  11468. careful attention must be paid to error checking.  The two most common error conditions
  11469. are missing resources and lack of memory.  Some error reporting and recovery facilities
  11470. have been provided in the Control Panel to help with errors encountered in a cdev.
  11471.  
  11472. Because the Control Panel has no direct information about the cdev, the cdev’s code
  11473. must be able to detect and recover from error conditions on its own.  If the recovery
  11474. cannot be effected the cdev must dispose of any memory it has allocated, and exit
  11475. back to the Control Panel with an error code.
  11476.  
  11477. Following a shutdown, the Control Panel can help report the error condition to the
  11478. user and prevent accidental reentry into the cdev that might result from such things
  11479. as an update event.  A cdev can request three different error reporting mechanisms
  11480. from the Control Panel:
  11481.  
  11482.   •  If a memory error has occured, then, after the cdev has safely shut
  11483.      itself down, it may request the Control Panel to issue an out-of-memory
  11484.      error message and gray out (paint over with the background pattern) the
  11485.      cdev area of the Control Panel window.  It will remain grayed until
  11486.      another cdev is selected.  The Control Panel window itself is not
  11487.      closed since other cdevs may still be able to function in the environment.
  11488.   •  If a resource error is detected, the cdev may request that a
  11489.      can’t-find-needed-resource error message be issued.
  11490.   •  The cdev may display its own error message and then call on the
  11491.      Control Panel to gray its area.
  11492.  
  11493. The Control Panel uses the cdevValue parameter to send status information to the
  11494. cdev, and a proper cdev uses its function value to send information back to the
  11495. Control Panel.  In the absence of errors, the same value passes back and forth: the
  11496. Control Panel puts the last function value it received into cdevValue when it calls
  11497. the cdev; the cdev returns the value it finds there as the function value.  The cdev
  11498. may want to keep a handle to its own storage, in which case passing it as the function
  11499. value ensures its availability, since the Control Panel will pass it back in cdevValue
  11500. at the next call.
  11501.  
  11502. Four constants have been defined for this cdev/Control Panel communication:
  11503.  
  11504. CONST
  11505.   cdevUnset   =     3;    {initial value passed in cdevValue}
  11506.   cdevGenErr  =    -1;    {generic cdev error}
  11507.   cdevMemErr  =     0;    {insufficient memory for cdev execution}
  11508.   cdevResErr  =     1;    {missing resource needed by cdev}
  11509.  
  11510. After the macDev call, the Control Panel sends cdevUnset in cdevValue, so that until
  11511. an error occurs or the cdev uses its function value as a handle, cdevUnset is passed
  11512. back and forth.  If the cdev encounters an error, it should dispose of all handles
  11513. and pointers it has set up, strip the stack back to the same position as a normal
  11514. exit, and return one of the three error codes as the function result.  The Control
  11515. Panel will respond as follows:
  11516.  
  11517.   Function           Message to                     Control Panel Action    
  11518.   Result             Control Panel   
  11519.  
  11520.   cdevGenErr         The cdev has encountered an    Gray out the cdev’s area,
  11521.                      error from which it cannot     send a 0 in cdevValue in
  11522.                      recover, but do not put up     succeeding cdev calls
  11523.                      an error dialog.
  11524.  
  11525.   cdevMemErr         The cdev has determined that   Gray out cdev’s area, put
  11526.                      there is not enough memory to  up error dialog, send a 0
  11527.                      execute; please put up a       in cdevValue in succeeding
  11528.                      memory error dialog.           cdev calls.
  11529.  
  11530.   cdevResErr         The cdev can’t find a needed   Gray out cdev’s area, put
  11531.                      resource; please put up a      up error dialog, send a 0
  11532.                      resource error dialog.         in cdevValue in succeeding
  11533.                                                     cdev calls.
  11534.  
  11535.   all other values,  No error conditions.           Send the value back in
  11536.   either handles                                    cdevValue.
  11537.   or cdevUnset
  11538.  
  11539. The cdev code should check cdevValue at entry.  A 0 means that the Control Panel has
  11540. responded to a cdev error message by shutting down the cdev and displaying an error
  11541. dialog if one was requested.  The cdev should immediately exit.
  11542.  
  11543. Once the Control Panel has responded to an error message from a cdev it will no
  11544. longer respond to any return values until another cdev is launched.
  11545.  
  11546. æKY DCtlEntry
  11547. DCtlPtr
  11548. DCtlHandle
  11549. æFp Devices.p
  11550. æT RECORD
  11551. æD DCtlPtr = ^DCtlEntry;
  11552. DCtlHandle = ^DCtlPtr;
  11553. DCtlEntry = RECORD
  11554.     dCtlDriver: Ptr;
  11555.     dCtlFlags: INTEGER;
  11556.     dCtlQHdr: QHdr;
  11557.     dCtlPosition: LONGINT;
  11558.     dCtlStorage: Handle;
  11559.     dCtlRefNum: INTEGER;
  11560.     dCtlCurTicks: LONGINT;
  11561.     dCtlWindow: WindowPtr;
  11562.     dCtlDelay: INTEGER;
  11563.     dCtlEMask: INTEGER;
  11564.     dCtlMenu: INTEGER;
  11565.     END;
  11566. æC 
  11567. »Device Control Entry
  11568.  
  11569. The first time a driver is opened, information about it is read into a structure in
  11570. memory called a device control entry. A device control entry contains the header of
  11571. the driver’s I/O queue, the location of the driver’s routines, and other information.
  11572. A device control entry is a 40-byte relocatable block located in the system heap.
  11573. It’s locked while the driver is open, and unlocked while the driver is closed.
  11574.  
  11575. Most of the data in the device control entry is stored and accessed only by the
  11576. Device Manager, but in some cases the driver itself must store into it. The structure
  11577. of a device control entry is shown below; note that the first four words of the
  11578. driver are copied into the dCtlFlags, dCtlDelay, dCtlEMask, and dCtlMenu fields.
  11579.  
  11580. TYPE  DCtlEntry = RECORD
  11581.                     dCtlDriver:    Ptr;        {pointer to ROM driver or }
  11582.                                                { handle to RAM driver}
  11583.                     dCtlFlags:     INTEGER;    {flags}
  11584.                     dCtlQHdr:      QHdr;       {driver I/O queue header}
  11585.                     dCtlPosition:  LONGINT;    {byte position used by Read }
  11586.                                                { and Write calls}
  11587.                     dCtlStorage:   Handle;     {handle to RAM driver's }
  11588.                                                { private storage}
  11589.                     dCtlRefNum:    INTEGER;    {driver reference number}
  11590.                     dCtlCurTicks:  LONGINT;    {used internally}
  11591.                     dCtlWindow:    WindowPtr;  {pointer to driver's window}
  11592.                     dCtlDelay:     INTEGER;    {number of ticks between }
  11593.                                                { periodic actions}
  11594.                     dCtlEMask:     INTEGER;    {desk accessory event mask}
  11595.                     dCtlMenu:      INTEGER     {menu ID of menu associated
  11596.                                                { with driver}
  11597.                   END;
  11598.  
  11599.       DCtlPtr    = ^DCtlEntry;
  11600.       DCtlHandle = ^DCtlPtr;
  11601.  
  11602. The low-order byte of the dCtlFlags word contains the following flags:
  11603.  
  11604. Bit number    Meaning
  11605.  
  11606.     5         Set if driver is open
  11607.     6         Set if driver is RAM-based
  11608.     7         Set if driver is currently executing
  11609.  
  11610. Assembly-language note:  These flags can be accessed with the global
  11611.                          constants dOpened, dRAMBased, and drvrActive.
  11612.  
  11613. The high-order byte of the dCtlFlags word contains flags copied from the drvrFlags
  11614. word of the driver, as described above.
  11615.  
  11616. DCtlQHdr contains the header of the driver’s I/O queue (described below). DCtlPosition
  11617. is used only by drivers of block devices, and indicates the current source or destination
  11618. position of a Read or Write call. The position is given as a number of bytes beyond
  11619. the physical beginning of the medium used by the device. For example, if one logical
  11620. block of data has just been read from a 3 1/2-inch disk via the Disk Driver, dCtlPosition
  11621. will be 512.
  11622.  
  11623. ROM drivers generally use locations in low memory for their local storage. RAM drivers
  11624. may reserve memory within their code space, or allocate a relocatable block and keep
  11625. a handle to it in dCtlStorage (if the block resides in the application heap, its
  11626. handle will be set to NIL when the heap is reinitialized).
  11627.  
  11628. You can get a handle to a driver’s device control entry by calling the Device Manager
  11629. function GetDCtlEntry.
  11630.  
  11631. æKY AuxDCE
  11632. AuxDCEPtr
  11633. AuxDCEHandle
  11634. æFp Devices.p
  11635. æT RECORD
  11636. æD AuxDCEPtr = ^AuxDCE;
  11637. AuxDCEHandle = ^AuxDCEPtr;
  11638. AuxDCE = PACKED RECORD
  11639.     dCtlDriver: Ptr;
  11640.     dCtlFlags: INTEGER;
  11641.     dCtlQHdr: QHdr;
  11642.     dCtlPosition: LONGINT;
  11643.     dCtlStorage: Handle;
  11644.     dCtlRefNum: INTEGER;
  11645.     dCtlCurTicks: LONGINT;
  11646.     dCtlWindow: GrafPtr;
  11647.     dCtlDelay: INTEGER;
  11648.     dCtlEMask: INTEGER;
  11649.     dCtlMenu: INTEGER;
  11650.     dCtlSlot: Byte;
  11651.     dCtlSlotId: Byte;
  11652.     dCtlDevBase: LONGINT;
  11653.     dCtlOwner: Ptr;
  11654.     dCtlExtDev: Byte;
  11655.     fillByte: Byte;
  11656.     END;
  11657. æC 
  11658.  
  11659. æKY GetDCtlEntry
  11660. æFp Devices.p
  11661. æT FUNCTION
  11662. æD FUNCTION GetDCtlEntry(refNum: INTEGER): DCtlHandle;
  11663. æDT myVariable := GetDCtlEntry(refNum);
  11664. æMM
  11665. æRT 71
  11666. æRI II-190
  11667. æC 
  11668. [Not in ROM]
  11669.  
  11670. GetDCtlEntry returns a handle to the device control entry of the device driver having
  11671. the reference number refNum.
  11672.  
  11673. Assembly-language note:  You can get a handle to a driver’s device control
  11674.                          entry from the unit table, as described below.
  11675.  
  11676. æKY SetChooserAlert
  11677. æFp Devices.p
  11678. æT FUNCTION
  11679. æD FUNCTION SetChooserAlert(f: BOOLEAN): BOOLEAN;
  11680. æDT myVariable := SetChooserAlert(f);
  11681. æRI V-431
  11682. æC f f is true, the Chooser will put up the page setup alert; if f is false
  11683. it won’t.  SetChooserAlert returns the original alert state.  The 
  11684. application should restore the original alert state when it exits.
  11685. _____________________________________________________________________________________
  11686. Assembly-language note:  If the psAlert bit of the low-memory global
  11687. HiliteMode is 0 then no page setup alert will be generated. 
  11688. Applications that set or clear this bit must be sure not to affect
  11689. any other bits in the byte and to restore the bit as they leave.
  11690.      
  11691. HiliteMode  equ  $938
  11692. psAlert     equ  6
  11693. bclr        #psAlert,HiliteMode
  11694. bset        #psAlert,HiliteMode
  11695. _____________________________________________________________________________________
  11696.  
  11697. æKY OpenDriver
  11698. æFp Devices.p
  11699. æT FUNCTION
  11700. æD FUNCTION OpenDriver(name: Str255;VAR drvrRefNum: INTEGER): OSErr;
  11701. æDT myVariable := OpenDriver(name,drvrRefNum);
  11702. æMM
  11703. æRI II-178, N14-2
  11704. æC 
  11705. [Not in ROM]
  11706.  
  11707. OpenDriver opens the device driver specified by name and returns its reference number
  11708. in refNum.
  11709.  
  11710. Result codes    noErr           No error
  11711.                 badUnitErr      Bad reference number
  11712.                 dInstErr        Couldn’t find driver in resource file
  11713.                 openErr         Driver can’t perform the requested
  11714.                                 reading or writing
  11715.                 unitEmptyErr    Bad reference number
  11716.  
  11717. æKY CloseDriver
  11718. æFp Devices.p
  11719. æT FUNCTION
  11720. æD FUNCTION CloseDriver(refNum: INTEGER): OSErr;
  11721. æDT myVariable := CloseDriver(refNum);
  11722. æRI II-178
  11723. æC 
  11724. [Not in ROM]
  11725.  
  11726. CloseDriver closes the device driver having the reference number refNum. Any pending
  11727. I/O is completed, and the memory used by the driver is released.
  11728.  
  11729. Warning:  Before using this command to close a particular driver, refer
  11730.           to the chapter describing the driver for the consequences of
  11731.           closing it.
  11732.  
  11733. Result codes    noErr           No error
  11734.                 badUnitErr      Bad reference number
  11735.                 dRemoveErr      Attempt to remove an open driver
  11736.                 unitEmptyErr    Bad reference number
  11737.  
  11738. æKY Control
  11739. æFp Devices.p
  11740. æT FUNCTION
  11741. æD FUNCTION Control(refNum: INTEGER;csCode: INTEGER;csParamPtr: Ptr): OSErr;
  11742. æDT myVariable := Control(refNum,csCode,csParamPtr);
  11743. æMM
  11744. æRI II-186
  11745. æC 
  11746. [Not in ROM]
  11747.  
  11748. Control sends control information to the device driver having the reference number
  11749. refNum. The type of information sent is specified by csCode, and the information
  11750. itself is pointed to by csParamPtr. The values passed in csCode and pointed to by
  11751. csParamPtr depend on the driver being called.
  11752.  
  11753. Result codes    noErr           No error
  11754.                 badUnitErr      Bad reference number
  11755.                 notOpenErr      Driver isn’t open
  11756.                 unitEmptyErr    Bad reference number
  11757.                 controlErr      Driver can’t respond to this Control call
  11758.  
  11759. æKY Status
  11760. æFp Devices.p
  11761. æT FUNCTION
  11762. æD FUNCTION Status(refNum: INTEGER;csCode: INTEGER;csParamPtr: Ptr): OSErr;
  11763. æDT myVariable := Status(refNum,csCode,csParamPtr);
  11764. æMM
  11765. æRI II-186
  11766. æC 
  11767. [Not in ROM]
  11768.  
  11769. Status returns status information about the device driver having the reference number
  11770. refNum. The type of information returned is specified by csCode, and the information
  11771. itself is pointed to by csParamPtr. The values passed in csCode and pointed to by
  11772. csParamPtr depend on the driver being called.
  11773.  
  11774. Result codes    noErr           No error
  11775.                 badUnitErr      Bad reference number
  11776.                 notOpenErr      Driver isn’t open
  11777.                 unitEmptyErr    Bad reference number
  11778.                 statusErr       Driver can’t respond to this Status call
  11779.  
  11780. æKY KillIO
  11781. æFp Devices.p
  11782. æT FUNCTION
  11783. æD FUNCTION KillIO(refNum: INTEGER): OSErr;
  11784. æDT myVariable := KillIO(refNum);
  11785. æRI II-179 
  11786. æC 
  11787. [Not in ROM]
  11788.  
  11789. KillIO terminates all current and pending I/O with the device driver having the
  11790. reference number refNum.
  11791.  
  11792. Result codes    noErr           No error
  11793.                 badUnitErr      Bad reference number
  11794.                 unitEmptyErr    Bad reference number
  11795.  
  11796. æKY PBControl
  11797. æFp Devices.p
  11798. æT FUNCTION
  11799. æD FUNCTION PBControl(paramBlock: ParmBlkPtr;aSync: BOOLEAN): OSErr;
  11800. æDT myVariable := PBControl(paramBlock,aSync);
  11801. æMM
  11802. æRI II-186
  11803. æC 
  11804. Trap macro    _Control
  11805.  
  11806. Parameter block
  11807.   -->    12    ioCompletion  pointer
  11808.   <--    16    ioResult      word
  11809.   -->    22    ioVRefNum     word
  11810.   -->    24    ioRefNum      word
  11811.   -->    26    csCode        word
  11812.   -->    28    csParam       record
  11813.  
  11814. PBControl sends control information to the device driver having the reference number
  11815. ioRefNum; the drive number, if any, is specified by ioVRefNum. The type of information
  11816. sent is specified by csCode, and the information itself begins at csParam. The values
  11817. passed in csCode and csParam depend on the driver being called.
  11818.  
  11819. Result codes    noErr           No error
  11820.                 badUnitErr      Bad reference number
  11821.                 notOpenErr      Driver isn’t open
  11822.                 unitEmptyErr    Bad reference number
  11823.                 controlErr      Driver can’t respond to this Control call
  11824.  
  11825. æKY PBStatus
  11826. æFp Devices.p
  11827. æT FUNCTION
  11828. æD FUNCTION PBStatus(paramBlock: ParmBlkPtr;aSync: BOOLEAN): OSErr;
  11829. æDT myVariable := PBStatus(paramBlock,aSync);
  11830. æMM
  11831. æRI II-186
  11832. æC 
  11833. Trap macro    _Status
  11834.  
  11835. Parameter block
  11836.   -->    12    ioCompletion  pointer
  11837.   <--    16    ioResult      word
  11838.   -->    22    ioVRefNum     word
  11839.   -->    24    ioRefNum      word
  11840.   -->    26    csCode        word
  11841.   <--    28    csParam       record
  11842.  
  11843. PBStatus returns status information about the device driver having the reference
  11844. number ioRefNum; the drive number, if any, is specified by ioVRefNum. The type of
  11845. information returned is specified by csCode, and the information itself begins at
  11846. csParam. The values passed in csCode and csParam depend on the driver being called.
  11847.  
  11848. Result codes    noErr           No error
  11849.                 badUnitErr      Bad reference number
  11850.                 notOpenErr      Driver isn’t open
  11851.                 unitEmptyErr    Bad reference number
  11852.                 statusErr       Driver can’t respond to this Status call
  11853.  
  11854. æKY PBKillIO
  11855. æFp Devices.p
  11856. æT FUNCTION
  11857. æD FUNCTION PBKillIO(paramBlock: ParmBlkPtr;aSync: BOOLEAN): OSErr;
  11858. æDT myVariable := PBKillIO(paramBlock,aSync);
  11859. æRI II-187
  11860. æC 
  11861. Trap macro    _KillIO
  11862.  
  11863. Parameter block
  11864.   -->    12    ioCompletion  pointer
  11865.   <--    16    ioResult      word
  11866.   -->    24    ioRefNum      word
  11867.  
  11868. PBKillIO stops any current I/O request being processed, and removes all pending I/O
  11869. requests from the I/O queue of the device driver having the reference number ioRefNum.
  11870. The completion routine of each pending I/O request is called, with the ioResult field
  11871. of each request equal to the result code abortErr.
  11872.  
  11873. Result codes    noErr           No error
  11874.                 badUnitErr      Bad reference number
  11875.                 unitEmptyErr    Bad reference number
  11876.  
  11877.  
  11878. æKY Dialogs.p
  11879. æKL Alert
  11880. CautionAlert
  11881. CloseDialog
  11882. CouldAlert
  11883. CouldDialog
  11884. DialogSelect
  11885. DisposDialog
  11886. DlgCopy
  11887. DlgCut
  11888. DlgDelete
  11889. DlgPaste
  11890. DrawDialog
  11891. ErrorSound
  11892. FindDItem
  11893. FreeAlert
  11894. FreeDialog
  11895. GetAlrtStage
  11896. GetDItem
  11897. GetIText
  11898. GetNewDialog
  11899. HideDItem
  11900. InitDialogs
  11901. IsDialogEvent
  11902. ModalDialog
  11903. NewCDialog
  11904. NewDialog
  11905. NoteAlert
  11906. ParamText
  11907. ResetAlrtStage
  11908. SelIText
  11909. SetDAFont
  11910. SetDItem
  11911. SetIText
  11912. ShowDItem
  11913. StopAlert
  11914. UpdtDialog
  11915.  
  11916. AlertTemplate
  11917. AlertTHndl
  11918. AlertTPtr
  11919. btnCtrl
  11920. cancel
  11921. cautionIcon
  11922. chkCtrl
  11923. ctrlItem
  11924. DialogPeek
  11925. DialogPtr
  11926. DialogRecord
  11927. DialogTemplate
  11928. DialogTHndl
  11929. DialogTPtr
  11930. editText
  11931. iconItem
  11932. itemDisable
  11933. noteIcon
  11934. ok
  11935. picItem
  11936. radCtrl
  11937. resCtrl
  11938. StageList
  11939. statText
  11940. stopIcon
  11941. userItem
  11942.  
  11943. æKY ctrlItem
  11944. æFp Dialogs.p
  11945. æT CONST
  11946. æD ctrlItem = 4;
  11947. æC 
  11948.  
  11949. æKY btnCtrl
  11950. æFp Dialogs.p
  11951. æT CONST
  11952. æD btnCtrl = 0;
  11953. æC 
  11954.  
  11955. æKY chkCtrl
  11956. æFp Dialogs.p
  11957. æT CONST
  11958. æD chkCtrl = 1;
  11959. æC 
  11960.  
  11961. æKY radCtrl
  11962. æFp Dialogs.p
  11963. æT CONST
  11964. æD radCtrl = 2;
  11965. æC 
  11966.  
  11967. æKY resCtrl
  11968. æFp Dialogs.p
  11969. æT CONST
  11970. æD resCtrl = 3;
  11971. æC 
  11972.  
  11973. æKY statText
  11974. æFp Dialogs.p
  11975. æT CONST
  11976. æD statText = 8;
  11977. æC 
  11978.  
  11979. æKY editText
  11980. æFp Dialogs.p
  11981. æT CONST
  11982. æD editText = 16;
  11983. æC 
  11984.  
  11985. æKY iconItem
  11986. æFp Dialogs.p
  11987. æT CONST
  11988. æD iconItem = 32;
  11989. æC 
  11990.  
  11991. æKY picItem
  11992. æFp Dialogs.p
  11993. æT CONST
  11994. æD picItem = 64;
  11995. æC 
  11996.  
  11997. æKY userItem
  11998. æFp Dialogs.p
  11999. æT CONST
  12000. æD userItem = 0;
  12001. æC 
  12002.  
  12003. æKY itemDisable
  12004. æFp Dialogs.p
  12005. æT CONST
  12006. æD itemDisable = 128;
  12007. æC 
  12008.  
  12009. æKY ok
  12010. æFp Dialogs.p
  12011. æT CONST
  12012. æD ok = 1;
  12013. æC 
  12014.  
  12015. æKY cancel
  12016. æFp Dialogs.p
  12017. æT CONST
  12018. æD cancel = 2;
  12019. æC 
  12020.  
  12021. æKY stopIcon
  12022. æFp Dialogs.p
  12023. æT CONST
  12024. æD stopIcon = 0;
  12025. æC 
  12026.  
  12027. æKY noteIcon
  12028. æFp Dialogs.p
  12029. æT CONST
  12030. æD noteIcon = 1;
  12031. æC 
  12032.  
  12033. æKY cautionIcon
  12034. æFp Dialogs.p
  12035. æT CONST
  12036. æD cautionIcon = 2;
  12037. æC 
  12038.  
  12039. æKY DialogRecord
  12040. DialogPeek
  12041. æFp Dialogs.p
  12042. æT RECORD
  12043. æD DialogPeek = ^DialogRecord;
  12044. DialogRecord = RECORD
  12045.     window: WindowRecord;
  12046.     items: Handle;
  12047.     textH: TEHandle;
  12048.     editField: INTEGER;
  12049.     editOpen: INTEGER;
  12050.     aDefItem: INTEGER;
  12051.     END;
  12052. æC 
  12053. »The DialogRecord Data Type
  12054.  
  12055. For those who want to know more about the data structure of a dialog record, the
  12056. exact structure is given here.
  12057.  
  12058. TYPE  DialogRecord = RECORD
  12059.                        window:     WindowRecord;  {dialog window}
  12060.                        items:      Handle;        {item list}
  12061.                        textH:      TEHandle;      {current editText item}
  12062.                        editField:  INTEGER;       {editText item number minus 1}
  12063.                        editOpen:   INTEGER;       {used internally}
  12064.                        aDefItem:   INTEGER        {default button item number}
  12065.                      END;
  12066.  
  12067. The window field contains the window record for the dialog window. The items field
  12068. contains a handle to the item list used for the dialog. (Remember that after reading
  12069. an item list from a resource file, the Dialog Manager makes a copy of it and uses
  12070. that copy.)
  12071.  
  12072. Note:  To get or change information about an item in a dialog, you pass the
  12073.        dialog pointer and the item number to a Dialog Manager procedure.
  12074.        You’ll never access information directly through the handle to the
  12075.        item list.
  12076.  
  12077. The Dialog Manager uses the next three fields when there are one or more editText
  12078. items in the dialog. If there’s more than one such item, these fields apply to the
  12079. one that currently is selected or displays the insertion point. The textH field
  12080. contains the handle to the edit record used by TextEdit. EditField is 1 less than the
  12081. item number of the current editText item, or –1 if there’s no editText item in the
  12082. dialog. The editOpen field is used internally by the Dialog Manager.
  12083.  
  12084. Note:  Actually, a single edit record is shared by all editText items; any
  12085.        changes you make to it will apply to all such items. See the TextEdit
  12086.        chapter for details about what kinds of changes you can make.
  12087.  
  12088. The aDefItem field is used for modal dialogs and alerts, which are treated internally
  12089. as special modal dialogs. It contains the item number of the default button. The
  12090. default button for a modal dialog is the first item in the item list, so this field
  12091. contains 1 for modal dialogs. The default button for an alert is specified in the
  12092. alert template; see the following section for more information.
  12093.  
  12094. æKY DialogPtr
  12095. æFp Dialogs.p
  12096. æT RECORD
  12097. æD DialogPtr = WindowPtr;
  12098. æC 
  12099. »Dialog Pointers
  12100.  
  12101. There are two types of dialog pointer, DialogPtr and DialogPeek, analogous to the
  12102. window pointer types WindowPtr and WindowPeek. Most programmers will only need to use
  12103. DialogPtr.
  12104.  
  12105. The Dialog Manager defines the following type of dialog pointer:
  12106.  
  12107. TYPE  DialogPtr = WindowPtr;
  12108.  
  12109. It can do this because the first field of a dialog record contains the window record
  12110. for the dialog window. This type of pointer can be used to access fields of the
  12111. window record or can be passed to Window Manager routines that expect window pointers
  12112. as parameters. Since the WindowPtr data type is itself defined as GrafPtr, this type
  12113. of dialog pointer can also be used to access fields of the dialog window’s grafPort
  12114. or passed to QuickDraw routines that expect pointers to grafPorts as parameters.
  12115.  
  12116. For programmers who want to access dialog record fields beyond the window record, the
  12117. Dialog Manager also defines the following type of dialog pointer:
  12118.  
  12119. TYPE  DialogPeek = ^DialogRecord;
  12120.  
  12121. Assembly-language note:  From assembly language, of course, there’s no
  12122.                          type checking on pointers, and the two types
  12123.                          of pointer are equal.
  12124.  
  12125. _______________________________________________________________________________
  12126.  
  12127. »The DialogRecord Data Type
  12128.  
  12129. For those who want to know more about the data structure of a dialog record, the
  12130. exact structure is given here.
  12131.  
  12132. TYPE  DialogRecord = RECORD
  12133.                        window:     WindowRecord;  {dialog window}
  12134.                        items:      Handle;        {item list}
  12135.                        textH:      TEHandle;      {current editText item}
  12136.                        editField:  INTEGER;       {editText item number minus 1}
  12137.                        editOpen:   INTEGER;       {used internally}
  12138.                        aDefItem:   INTEGER        {default button item number}
  12139.                      END;
  12140.  
  12141. The window field contains the window record for the dialog window. The items field
  12142. contains a handle to the item list used for the dialog. (Remember that after reading
  12143. an item list from a resource file, the Dialog Manager makes a copy of it and uses
  12144. that copy.)
  12145.  
  12146. Note:  To get or change information about an item in a dialog, you pass the
  12147.        dialog pointer and the item number to a Dialog Manager procedure.
  12148.        You’ll never access information directly through the handle to the
  12149.        item list.
  12150.  
  12151. The Dialog Manager uses the next three fields when there are one or more editText
  12152. items in the dialog. If there’s more than one such item, these fields apply to the
  12153. one that currently is selected or displays the insertion point. The textH field
  12154. contains the handle to the edit record used by TextEdit. EditField is 1 less than the
  12155. item number of the current editText item, or –1 if there’s no editText item in the
  12156. dialog. The editOpen field is used internally by the Dialog Manager.
  12157.  
  12158. Note:  Actually, a single edit record is shared by all editText items; any
  12159.        changes you make to it will apply to all such items. See the TextEdit
  12160.        chapter for details about what kinds of changes you can make.
  12161.  
  12162. The aDefItem field is used for modal dialogs and alerts, which are treated internally
  12163. as special modal dialogs. It contains the item number of the default button. The
  12164. default button for a modal dialog is the first item in the item list, so this field
  12165. contains 1 for modal dialogs. The default button for an alert is specified in the
  12166. alert template; see the following section for more information.
  12167.  
  12168. _______________________________________________________________________________
  12169.  
  12170. »THE DRAWING ENVIRONMENT:  GRAFPORT
  12171. _______________________________________________________________________________
  12172.  
  12173. A grafPort is a complete drawing environment that defines where and how graphic
  12174. operations will take place. You can have many grafPorts open at once, and each one
  12175. will have its own coordinate system, drawing pattern, background pattern, pen size
  12176. and location, character font and style, and bit map in which drawing takes place. You
  12177. can instantly switch from one port to another. GrafPorts are the structures upon
  12178. which a program builds windows, which are fundamental to the Macintosh “overlapping
  12179. windows” user interface. Besides being used for windows on the screen, grafPorts are
  12180. used for printing and for off-screen drawing.
  12181.  
  12182. A grafPort is defined as follows:
  12183.  
  12184. TYPE  GrafPtr   =  ^GrafPort;
  12185.       GrafPort  =  RECORD
  12186.                      device:      INTEGER;    {device-specific information}
  12187.                      portBits:    BitMap;     {grafPort's bit map}
  12188.                      portRect:    Rect;       {grafPort's rectangle}
  12189.                      visRgn:      RgnHandle;  {visible region}
  12190.                      clipRgn:     RgnHandle;  {clipping region}
  12191.                      bkPat:       Pattern;    {background pattern}
  12192.                      fillPat:     Pattern;    {fill pattern}
  12193.                      pnLoc:       Point;      {pen location}
  12194.                      pnSize:      Point;      {pen size}
  12195.                      pnMode:      INTEGER;    {pen's transfer mode}
  12196.                      pnPat:       Pattern;    {pen pattern}
  12197.                      pnVis:       INTEGER;    {pen visibility}
  12198.                      txFont:      INTEGER;    {font number for text}
  12199.                      txFace:      Style;      {text's character style}
  12200.                      txMode:      INTEGER;    {text's transfer mode}
  12201.                      txSize:      INTEGER;    {font size for text}
  12202.                      spExtra:     Fixed;      {extra space}
  12203.                      fgColor:     LONGINT;    {foreground color}
  12204.                      bkColor:     LONGINT;    {background color}
  12205.                      colrBit:     INTEGER;    {color bit}
  12206.                      patStretch:  INTEGER;    {used internally}
  12207.                      picSave:     Handle;     {picture being saved}
  12208.                      rgnSave:     Handle;     {region being saved}
  12209.                      polySave:    Handle;     {polygon being saved}
  12210.                      grafProcs:   QDProcsPtr  {low-level drawing routines}
  12211.                    END;
  12212.  
  12213. Note that picSave is a Handle used internally by QuickDraw while it is saving a
  12214. picture, and rgnSave and polySave are used by QuickDraw as flags; they are set to “1”
  12215. when the corresponding action is taking place.
  12216.  
  12217. All QuickDraw operations refer to grafPorts via grafPtrs. (For historical reasons,
  12218. grafPort is one of the few objects in the Macintosh system software that’s referred
  12219. to by a pointer rather than a handle.)
  12220.  
  12221. Warning:  You can access all fields and subfields of a grafPort normally,
  12222.           but you should not store new values directly into them. QuickDraw
  12223.           has routines for altering all fields of a grafPort, and using
  12224.           these routines ensures that changing a grafPort produces no
  12225.           unusual side effects.
  12226.  
  12227. The device field of a grafPort contains device-specific information that’s used by
  12228. the Font Manager to achieve the best possible results when drawing text in the grafPort.
  12229. There may be physical differences in the same logical font for different output
  12230. devices, to ensure the highest-quality printing on the device being used. The default
  12231. value of the device field is 0, for best results on output to the screen. For more
  12232. information, see the Font Manager chapter.
  12233.  
  12234. The portBits field is the bit map that points to the bit image to be used by the
  12235. grafPort. The default bit map uses the entire screen as its bit image. The bit map
  12236. may be changed to indicate a different structure in memory:  All graphics routines
  12237. work in exactly the same way regardless of whether their effects are visible on the
  12238. screen. A program can, for example, prepare an image to be printed on a printer
  12239. without ever displaying the image on the screen, or develop a picture in an off-screen
  12240. bit map before transferring it to the screen. The portBits.bounds rectangle determines
  12241. the coordinate system of the grafPort; all other coordinates in the grafPort are
  12242. expressed in this system.
  12243.  
  12244. The portRect field is a rectangle that defines a subset of the bit map that will be
  12245. used for drawing:  All drawing done by the application occurs inside the portRect.
  12246. Its coordinates are in the coordinate system defined by the portBits.bounds rectangle.
  12247. The portRect usually falls within the portBits.bounds rectangle, but it’s not required
  12248. to do so. The portRect usually defines the “writable” interior area of a window,
  12249. document, or other object on the screen.
  12250.  
  12251. The visRgn field is manipulated by the Window Manager; you will normally never change
  12252. a grafPort’s visRgn. It indicates the region of the grafPort that’s actually visible
  12253. on the screen, that is, the part of the window that’s not covered by other windows.
  12254. For example, if you move one window in front of another, the Window Manager logically
  12255. removes the area of overlap from the visRgn of the window in back. When you draw into
  12256. the back window, whatever’s being drawn is clipped to the visRgn so that it doesn’t
  12257. run over onto the front window. The default visRgn is set to the portRect.
  12258.  
  12259. The clipRgn is the grafPort’s clipping region, an arbitrary region that you can use
  12260. to limit drawing to any region within the portRect. If, for example, you want to draw
  12261. a half circle on the screen, you can set the clipRgn to half the square that would
  12262. enclose the whole circle, and then draw the whole circle. Only the half within the
  12263. clipRgn will actually be drawn in the grafPort. The default clipRgn is set arbitrarily
  12264. large, you have full control over its setting; as a matter of recommended programming
  12265. practice, it is advisable to make the default clipRgn rectangle smaller.
  12266.  
  12267. Figure 10 illustrates a typical bit map (as defined by portBits), portRect, visRgn,
  12268. and clipRgn.
  12269.  
  12270. •••Refer to Figure 10.•••
  12271.  
  12272. Figure 10–GrafPort Regions
  12273.  
  12274. The bkPat and fillPat fields of a grafPort contain patterns used by certain QuickDraw
  12275. routines. BkPat is the “background” pattern that’s used when an area is erased or
  12276. when bits are scrolled out of it. When asked to fill an area with a specified pattern,
  12277. QuickDraw stores the given pattern in the fillPat field and then calls a low-level
  12278. drawing routine that gets the pattern from that field. The various graphic operations
  12279. are discussed in detail later in the descriptions of individual QuickDraw routines.
  12280.  
  12281. Of the next ten fields, the first five determine characteristics of the graphics pen
  12282. and the last five determine characteristics of any text that may be drawn; these are
  12283. described in separate sections below.
  12284.  
  12285. The fgColor, bkColor, and colrBit fields contain values related to drawing in color.
  12286. FgColor is the grafPort’s foreground color and bkColor is its background color.
  12287. ColrBit tells the color imaging software which plane of the color picture to draw
  12288. into. For more information, see “Drawing in Color” in the section “General Discussion
  12289. of Drawing”.
  12290.  
  12291. The patStretch field is used during output to a printer to expand patterns if necessary.
  12292. The application should not change its value.
  12293.  
  12294. The picSave, rgnSave, and polySave fields reflect the state of picture, region, and
  12295. polygon definition, respectively. The application shouldn’t be concerned about exactly
  12296. what information the handle, if any, leads to; you may, however, save the current
  12297. value of rgnSave, set the field to NIL to disable the region definition, and later
  12298. restore it to the saved value to resume the region definition. The picSave and polySave
  12299. fields work similarly for pictures and polygons.
  12300.  
  12301. Finally, the grafProcs field may point to a special data structure that the application
  12302. stores into if it wants to customize QuickDraw drawing routines or use QuickDraw in
  12303. other advanced, highly specialized ways (see “Customizing QuickDraw Operations”). If
  12304. grafProcs is NIL, QuickDraw responds in the standard ways described in this chapter.
  12305.  
  12306. _______________________________________________________________________________
  12307.  
  12308. »Pen Characteristics
  12309.  
  12310. The pnLoc, pnSize, pnMode, pnPat, and pnVis fields of a grafPort deal with the graphics
  12311. “pen”. Each grafPort has one and only one such pen, which is used for drawing lines,
  12312. shapes, and text. The pen has four characteristics:  a location, a size (height and
  12313. width), a drawing mode, and a drawing pattern (see Figure
  12314. 11).
  12315.  
  12316. •••Refer to Figure 11.•••
  12317.  
  12318. Figure 11–A Graphics Pen
  12319.  
  12320. The pnLoc field specifies the point where QuickDraw will begin drawing the next line,
  12321. shape, or character. It can be anywhere on the coordinate plane:  There are no restrictions
  12322. on the movement or placement of the pen. Remember that the pen location is a point in
  12323. the grafPort’s coordinate system, not a pixel in a bit image. The top left corner of
  12324. the pen is at the pen location; the pen hangs below and to the right of this point.
  12325.  
  12326. The pen is rectangular in shape, and its width and height are specified by pnSize.
  12327. The default size is a 1-by-1-bit square; the width and height can range from (0,0) to
  12328. (30000,30000). If either the pen width or the pen height is less than 1, the pen will
  12329. not draw.
  12330.  
  12331. The pnMode and pnPat fields of a grafPort determine how the bits under the pen are
  12332. affected when lines or shapes are drawn. The pnPat is a pattern that’s used like the
  12333. “ink” in the pen. This pattern, like all other patterns drawn in the grafPort, is
  12334. always aligned with the port’s coordinate system:  The top left corner of the pattern
  12335. is aligned with the top left corner of the portRect, so that adjacent areas of the
  12336. same pattern will blend into a continuous, coordinated pattern.
  12337.  
  12338. The pnMode field determines how the pen pattern is to affect what’s already in the
  12339. bit image when lines or shapes are drawn. When the pen draws, QuickDraw first determines
  12340. what bits in the bit image will be affected and finds their corresponding bits in the
  12341. pattern. It then does a bit-by-bit comparison based on the pen mode, which specifies
  12342. one of eight Boolean operations to perform. The resulting bit is stored into its
  12343. proper place in the bit image. The pen modes are described under “Transfer Modes” in
  12344. the section “General Discussion of Drawing”.
  12345.  
  12346. The pnVis field determines the pen’s visibility, that is, whether it draws on the
  12347. screen. For more information, see the descriptions of HidePen and ShowPen under “Pen
  12348. and Line-Drawing Routines” in the “QuickDraw Routines” section.
  12349.  
  12350. _______________________________________________________________________________
  12351.  
  12352. »Text Characteristics
  12353.  
  12354. The txFont, txFace, txMode, txSize, and spExtra fields of a grafPort determine how
  12355. text will be drawn—the font, style, and size of characters and how they will be
  12356. placed in the bit image. QuickDraw can draw characters as quickly and easily as it
  12357. draws lines and shapes, and in many prepared fonts. Font means the complete set of
  12358. characters of one typeface. The characters may be drawn in any size and character
  12359. style (that is, with stylistic variations such as bold, italic, and underline).
  12360. Figure 12 shows two characters drawn by QuickDraw and some terms associated with
  12361. drawing text.
  12362.  
  12363. •••Refer to Figure 12.•••
  12364.  
  12365. Figure 12–QuickDraw Characters
  12366.  
  12367. Text is drawn with the base line positioned at the pen location.
  12368.  
  12369. The txFont field is a font number that identifies the character font to be used in
  12370. the grafPort. The font number 0 represents the system font. For more information
  12371. about the system font, the other font numbers recognized by the Font Manager, and the
  12372. construction, layout, and loading of fonts, see the Font Manager chapter.
  12373.  
  12374. A character font is defined as a collection of images that make up the individual
  12375. characters of the font. The characters can be of unequal widths, and they’re not
  12376. restricted to their “cells”:  The lower curl of a lowercase j, for example, can
  12377. stretch back under the previous character (typographers call this kerning). A font
  12378. can consist of up to 255 distinct characters, yet not all characters need to be
  12379. defined in a single font. In addition, each font contains a missing symbol to be
  12380. drawn in case of a request to draw a character that’s missing from the font.
  12381.  
  12382. The txFace field controls the character style of the text with values from the set
  12383. defined by the Style data type:
  12384.  
  12385. TYPE  StyleItem  = (bold,italic,underline,outline,shadow,condense,extend);
  12386.       Style      = SET OF StyleItem;
  12387.  
  12388. Assembly-language note:  In assembly language, this set is stored as a word
  12389.                          whose low-order byte contains bits representing the
  12390.                          style. The bit numbers are specified by the following
  12391.                          global constants:
  12392.  
  12393.                            boldBit       .EQU    0
  12394.                            italicBit     .EQU    1
  12395.                            ulineBit      .EQU    2
  12396.                            outlineBit    .EQU    3
  12397.                            shadowBit     .EQU    5
  12398.                            extendBit     .EQU    6
  12399.  
  12400.                          If all bits are 0, it represents the plain character
  12401.                          style.
  12402.  
  12403. You can apply stylistic variations either alone or in combination; Figure 13 illustrates
  12404. some as applied to the Geneva font. Most combinations usually look good only for
  12405. large font sizes.
  12406.  
  12407. •••Refer to Figure 13.•••
  12408.  
  12409. Figure 13–Stylistic Variations
  12410.  
  12411. If you specify bold, each character is repeatedly drawn one bit to the right an
  12412. appropriate number of times for extra thickness.
  12413.  
  12414. Italic adds an italic slant to the characters. Character bits above the base line are
  12415. skewed right; bits below the base line are skewed left.
  12416.  
  12417. Underline draws a line below the base line of the characters. If part of a character
  12418. descends below the base line (as “y” in Figure 13), the underline
  12419. isn’t drawn through the pixel on either side of the descending part.
  12420.  
  12421. Outline makes a hollow, outlined character rather than a solid one. Shadow also makes
  12422. an outlined character, but the outline is thickened below and to the right of the
  12423. character to achieve the effect of a shadow. If you specify bold along with outline
  12424. or shadow, the hollow part of the character is widened.
  12425.  
  12426. Condense and extend affect the horizontal distance between all characters, including
  12427. spaces. Condense decreases the distance between characters and extend increases it,
  12428. by an amount that the Font Manager determines is appropriate.
  12429.  
  12430. The txMode field controls the way characters are placed in the bit image. It functions
  12431. much like a pnMode:  When a character is drawn, QuickDraw determines which bits in
  12432. the bit image will be affected, does a bit-by-bit comparison based on the mode, and
  12433. stores the resulting bits into the bit image. These modes are described under “Transfer
  12434. Modes” in the section “General Discussion of Drawing”. Only three of them—srcOr,
  12435. srcXor, and srcBic—should be used for drawing text.
  12436.  
  12437. Note:  If you use scrCopy, some extra blank space will be appended at the
  12438.        end of the text.
  12439.  
  12440. The txSize field specifies the font size in points (where “point” is a typographical
  12441. term meaning approximately 1/72 inch). Any size from 1 to 127 points may be specified.
  12442. If the Font Manager doesn’t have the font in a specified size, it will scale a size
  12443. it does have as necessary to produce the size desired. A value of 0 in this field
  12444. represents the system font size (12 points).
  12445.  
  12446. Finally, the spExtra field is useful when a line of characters is to be drawn justified
  12447. such that it’s aligned with both a left and a right margin (sometimes called “full
  12448. justification”). SpExtra contains a fixed-point number equal to the average number of
  12449. pixels by which each space character should be widened to fill out the line. The
  12450. Fixed data type is described in the Macintosh Memory Management:  An Introduction
  12451. chapter.
  12452.  
  12453. _______________________________________________________________________________
  12454.  
  12455. »COORDINATES IN GRAFPORTS
  12456. _______________________________________________________________________________
  12457.  
  12458. Each grafPort has its own local coordinate system. All fields in the grafPort are
  12459. expressed in these coordinates, and all calculations and actions performed in QuickDraw
  12460. use the local coordinate system of the currently selected port.
  12461.  
  12462. Two things are important to remember:
  12463.  
  12464.   •  Each grafPort maps a portion of the coordinate plane into a similarly-
  12465.      sized portion of a bit image.
  12466.   •  The portBits.bounds rectangle defines the local coordinates for a grafPort.
  12467.  
  12468. The top left corner of portBits.bounds is always aligned around the first bit in the
  12469. bit image; the coordinates of that corner “anchor” a point on the grid to that bit in
  12470. the bit image. This forms a common reference point for multiple grafPorts that use
  12471. the same bit image (such as the screen); given a portBits.bounds rectangle for each
  12472. port, you know that their top left corners coincide.
  12473.  
  12474. The relationship between the portBits.bounds and portRect rectangles is very important:
  12475.  The portBits.bounds rectangle establishes a coordinate system for the port, and the
  12476. portRect rectangle indicates the section of the coordinate plane (and thus the bit
  12477. image) that will be used for drawing. The portRect usually falls inside the portBits.bounds
  12478. rectangle, but it’s not required to do so.
  12479.  
  12480. When a new grafPort is created, its bit map is set to point to the entire screen, and
  12481. both the portBits.bounds and the portRect are set to rectangles enclosing the screen.
  12482. The point (0,0) corresponds to the screen’s top left corner.
  12483.  
  12484. You can redefine the local coordinates of the top left corner of the grafPort’s
  12485. portRect, using the SetOrigin procedure. This offsets the coordinates of the grafPort’s
  12486. portBits.bounds rectangle, recalculating the coordinates of all points in the grafPort
  12487. to be relative to the new corner coordinates. For example, consider these procedure
  12488. calls:
  12489.  
  12490.   SetPort(gamePort);
  12491.   SetOrigin(90,80)
  12492.  
  12493. The call to SetPort sets the current grafPort to gamePort; the call to SetOrigin
  12494. changes the local coordinates of the top left corner of that port’s portRect to
  12495. (90,80) (see Figure 14).
  12496.  
  12497. •••Refer to Figure 14.•••
  12498.  
  12499. Figure 14–Changing Local Coordinates
  12500.  
  12501. This offsets the coordinates of the following elements:
  12502.  
  12503.   gamePort^.portBits.bounds
  12504.   gamePort^.portRect
  12505.   gamePort^.visRgn
  12506.  
  12507. These three elements are always kept “in sync”.
  12508.  
  12509. Notice that when the local coordinates of a grafPort are offset, the grafPort’s
  12510. clipRgn and pen location are not offset. A good way to think of it is that the port’s
  12511. structure “sticks” to the screen, while the document in the grafPort
  12512. (along with the pen and clipRgn) “sticks” to the coordinate system. For example, in
  12513. Figure 14, before SetOrigin, the visRgn and clipRgn are the same as the portRect.
  12514. After the SetOrigin call, the locations of portBits.bounds, portRect, and visRgn do
  12515. not change on the screen; their coordinates are simply offset. As always, the top
  12516. left corner of portBits.bounds remains “anchored” around the first bit in the bit
  12517. image (the first pixel on the screen); the image on the screen doesn’t move as a
  12518. result of SetOrigin. However, the pen location and clipRgn do move on the screen; the
  12519. top left corner of the clipRgn is still
  12520. (100,100), but this location has moved down and to the right, and the pen has similarly
  12521. moved.
  12522.  
  12523. If you’re moving, comparing, or otherwise dealing with mathematical items in different
  12524. grafPorts (for example, finding the intersection of two regions in two different
  12525. grafPorts), you must adjust to a common coordinate system before you perform the
  12526. operation. A QuickDraw procedure, LocalToGlobal, lets you convert a point’s local
  12527. coordinates to a global coordinate system where the top left corner of the bit image
  12528. is (0,0); by converting the various local coordinates to global coordinates, you can
  12529. compare and mix them with confidence. For more information, see the description of
  12530. LocaltoGlobal under “Calculations with Points” in the “QuickDraw Routines” section.
  12531.  
  12532. æKY DialogTemplate
  12533. DialogTPtr
  12534. DialogTHndl
  12535. æFp Dialogs.p
  12536. æT RECORD
  12537. æD DialogTPtr = ^DialogTemplate;
  12538. DialogTHndl = ^DialogTPtr;
  12539. DialogTemplate = RECORD
  12540.     boundsRect: Rect;
  12541.     procID: INTEGER;
  12542.     visible: BOOLEAN;
  12543.     filler1: BOOLEAN;
  12544.     goAwayFlag: BOOLEAN;
  12545.     filler2: BOOLEAN;
  12546.     refCon: LONGINT;
  12547.     itemsID: INTEGER;
  12548.     title: Str255;
  12549.     END;
  12550. æC 
  12551. »Dialog Templates in Memory
  12552.  
  12553. The data structure of a dialog template is as follows:
  12554.  
  12555. TYPE DialogTemplate = RECORD
  12556.                         boundsRect:  Rect;     {becomes window's portRect}
  12557.                         procID:      INTEGER;  {window definiton ID}
  12558.                         visible:     BOOLEAN;  {TRUE if visible}
  12559.                         filler1:     BOOLEAN;  {not used}
  12560.                         goAwayFlag:  BOOLEAN;  {TRUE if has go-away region}
  12561.                         filler2:     BOOLEAN;  {not used}
  12562.                         refCon:      LONGINT;  {window's reference value}
  12563.                         itemsID:     INTEGER;  {resource ID of item list}
  12564.                         title:       Str255    {window's title}
  12565.                       END;
  12566.  
  12567. The filler1 and filler2 fields are there because for historical reasons the goAwayFlag
  12568. and refCon fields have to begin on a word boundary. The itemsID field contains the
  12569. resource ID of the dialog’s item list. The other fields are the same as the parameters
  12570. of the same name in the NewDialog function; they provide information about the dialog
  12571. window.
  12572.  
  12573. You access the dialog template by converting the handle returned by the Resource
  12574. Manager to a template handle:
  12575.  
  12576. TYPE  DialogTHndl  = ^DialogTPtr;
  12577.       DialogTPtr   = ^DialogTemplate;
  12578.  
  12579. æKY StageList
  12580. æFp Dialogs.p
  12581. æT RECORD
  12582. æD StageList = PACKED RECORD
  12583.     boldItm4: 0..1; {default button item number - 1}
  12584.     boxDrwn4: BOOLEAN; {true if alert box to be drawn}
  12585.     sound4: 0..3; {sound number}
  12586.     boldItm3: 0..1;
  12587.     boxDrwn3: BOOLEAN;
  12588.     sound3: 0..3;
  12589.     boldItm2: 0..1;
  12590.     boxDrwn2: BOOLEAN;
  12591.     sound2: 0..3;
  12592.     boldItm1: 0..1;
  12593.     boxDrwn1: BOOLEAN;
  12594.     sound1: 0..3;
  12595.     END;
  12596. æC 
  12597. »Alert Templates in Memory
  12598.  
  12599. The data structure of an alert template is as follows:
  12600.  
  12601. TYPE AlertTemplate = RECORD
  12602.                        boundsRect:  Rect;      {becomes window's portRect}
  12603.                        itemsID:     INTEGER;   {resource ID of item list}
  12604.                        stages:      StageList  {alert stage information}
  12605.                      END;
  12606.  
  12607. BoundsRect is the rectangle that becomes the portRect of the window's grafPort. The
  12608. itemsID field contains the resource ID of the item list for the alert.
  12609.  
  12610. The information in the stages field determines exactly what should happen at each
  12611. stage of the alert. It's packed into a word that has the following structure:
  12612.  
  12613. TYPE StageList = PACKED RECORD
  12614.                    boldItm4:  0..1;     {default button item number minus 1}
  12615.                    boxDrwn4:  BOOLEAN;  {TRUE if alert box to be drawn}
  12616.                    sound4:    0..3      {sound number}
  12617.                    boldItm3:  0..1; 
  12618.                    boxDrwn3:  BOOLEAN; 
  12619.                    sound3:    0..3 
  12620.                    boldItm2:  0..1; 
  12621.                    boxDrwn2:  BOOLEAN; 
  12622.                    sound2:    0..3 
  12623.                    boldItm1:  0..1; 
  12624.                    boxDrwn1:  BOOLEAN; 
  12625.                    sound1:    0..3 
  12626.                  END;
  12627.  
  12628. Notice that the information is stored in reverse order—for the fourth stage first,
  12629. and for the first stage last.
  12630.  
  12631. The boldItm field indicates which button should be the default button (and therefore
  12632. boldly outlined in the alert box). If the first two items in the alert’s item list
  12633. are the OK button and the Cancel button, respectively, 0 will refer to the OK button
  12634. and 1 to the Cancel button. The reason for this is that the value of boldItm plus 1
  12635. is interpreted as an item number, and normally items 1 and 2 are the OK and Cancel
  12636. buttons, respectively. Whatever the item having the corresponding item number happens
  12637. to be, a bold rounded-corner rectangle will be drawn outside its display rectangle.
  12638.  
  12639. Note:  When deciding where to place items in an alert box, be sure to allow
  12640.        room for any bold outlines that may be drawn.
  12641.  
  12642. The boxDrwn field is TRUE if the alert box is to be drawn.
  12643.  
  12644. The sound field specifies which sound should be emitted at this stage of the alert,
  12645. with a number from 0 to 3 that’s passed to the current sound procedure. You can call
  12646. ErrorSound to specify your own sound procedure; if you don’t, the standard sound
  12647. procedure will be used (as described earlier in the “Alerts” section).
  12648.  
  12649. You access the alert template by converting the handle returned by the Resource
  12650. Manager to a template handle:
  12651.  
  12652. TYPE  AlertTHndl = ^AlertTPtr;
  12653.       AlertTPtr  = ^AlertTemplate;
  12654.  
  12655. Assembly-language note:  Rather than offsets into the fields of the StageList
  12656.                          data structure, there are masks for accessing the
  12657.                          information stored for an alert stage in a stages
  12658.                          word; they’re listed in the summary at the end of
  12659.                          this chapter.
  12660.  
  12661. æKY AlertTemplate
  12662. AlertTPtr
  12663. AlertTHndl
  12664. æFp Dialogs.p
  12665. æT RECORD
  12666. æD AlertTPtr = ^AlertTemplate;
  12667. AlertTHndl = ^AlertTPtr;
  12668. AlertTemplate = RECORD
  12669.     boundsRect: Rect;
  12670.     itemsID: INTEGER;
  12671.     stages: StageList;
  12672.     END;
  12673. æC 
  12674. »Alert Templates in Memory
  12675.  
  12676. The data structure of an alert template is as follows:
  12677.  
  12678. TYPE AlertTemplate = RECORD
  12679.                        boundsRect:  Rect;      {becomes window's portRect}
  12680.                        itemsID:     INTEGER;   {resource ID of item list}
  12681.                        stages:      StageList  {alert stage information}
  12682.                      END;
  12683.  
  12684. BoundsRect is the rectangle that becomes the portRect of the window's grafPort. The
  12685. itemsID field contains the resource ID of the item list for the alert.
  12686.  
  12687. The information in the stages field determines exactly what should happen at each
  12688. stage of the alert. It's packed into a word that has the following structure:
  12689.  
  12690. TYPE StageList = PACKED RECORD
  12691.                    boldItm4:  0..1;     {default button item number minus 1}
  12692.                    boxDrwn4:  BOOLEAN;  {TRUE if alert box to be drawn}
  12693.                    sound4:    0..3      {sound number}
  12694.                    boldItm3:  0..1; 
  12695.                    boxDrwn3:  BOOLEAN; 
  12696.                    sound3:    0..3 
  12697.                    boldItm2:  0..1; 
  12698.                    boxDrwn2:  BOOLEAN; 
  12699.                    sound2:    0..3 
  12700.                    boldItm1:  0..1; 
  12701.                    boxDrwn1:  BOOLEAN; 
  12702.                    sound1:    0..3 
  12703.                  END;
  12704.  
  12705. Notice that the information is stored in reverse order—for the fourth stage first,
  12706. and for the first stage last.
  12707.  
  12708. The boldItm field indicates which button should be the default button (and therefore
  12709. boldly outlined in the alert box). If the first two items in the alert’s item list
  12710. are the OK button and the Cancel button, respectively, 0 will refer to the OK button
  12711. and 1 to the Cancel button. The reason for this is that the value of boldItm plus 1
  12712. is interpreted as an item number, and normally items 1 and 2 are the OK and Cancel
  12713. buttons, respectively. Whatever the item having the corresponding item number happens
  12714. to be, a bold rounded-corner rectangle will be drawn outside its display rectangle.
  12715.  
  12716. Note:  When deciding where to place items in an alert box, be sure to allow
  12717.        room for any bold outlines that may be drawn.
  12718.  
  12719. The boxDrwn field is TRUE if the alert box is to be drawn.
  12720.  
  12721. The sound field specifies which sound should be emitted at this stage of the alert,
  12722. with a number from 0 to 3 that’s passed to the current sound procedure. You can call
  12723. ErrorSound to specify your own sound procedure; if you don’t, the standard sound
  12724. procedure will be used (as described earlier in the “Alerts” section).
  12725.  
  12726. You access the alert template by converting the handle returned by the Resource
  12727. Manager to a template handle:
  12728.  
  12729. TYPE  AlertTHndl = ^AlertTPtr;
  12730.       AlertTPtr  = ^AlertTemplate;
  12731.  
  12732. Assembly-language note:  Rather than offsets into the fields of the StageList
  12733.                          data structure, there are masks for accessing the
  12734.                          information stored for an alert stage in a stages
  12735.                          word; they’re listed in the summary at the end of
  12736.                          this chapter.
  12737.  
  12738. æKY InitDialogs
  12739. æFp Dialogs.p
  12740. æT PROCEDURE
  12741. æTN A97B
  12742. æD PROCEDURE InitDialogs(resumeProc: ProcPtr);
  12743.     INLINE $A97B;
  12744. æDT InitDialogs(resumeProc);
  12745. æRI I-411, P-107, 112, 174
  12746. æC  
  12747. Call InitDialogs once before all other Dialog Manager routines, to initialize the
  12748. Dialog Manager. InitDialogs does the following initialization:
  12749.  
  12750.   •  It saves the pointer passed in resumeProc, if any, for access by the
  12751.      System Error Handler in case a fatal system error occurs. ResumeProc
  12752.      can be a pointer to a resume procedure, as described in the System
  12753.      Error Handler chapter, or NIL if no such procedure is desired.
  12754.  
  12755. Assembly-language note:  InitDialogs stores the address of the resume
  12756.                          procedure in a global variable named ResumeProc.
  12757.  
  12758.   •  It installs the standard sound procedure.
  12759.   •  It passes empty strings to ParamText.
  12760.  
  12761. æKY ErrorSound
  12762. æFp Dialogs.p
  12763. æT PROCEDURE
  12764. æTN A98C
  12765. æD PROCEDURE ErrorSound(soundProc: ProcPtr);
  12766.     INLINE $A98C;
  12767. æDT ErrorSound(soundProc);
  12768. æRI I-411
  12769. æC  
  12770. ErrorSound sets the sound procedure for alerts to the procedure pointed to by soundProc;
  12771. if you don’t call ErrorSound, the Dialog Manager uses the standard sound procedure.
  12772. (For details, see the “Alerts” section.) If you pass NIL for soundProc, there will be
  12773. no sound (or menu bar blinking) at all.
  12774.  
  12775. Assembly-language note:  The address of the sound procedure being used is
  12776.                          stored in the global variable DABeeper.
  12777.  
  12778. æKY NewDialog
  12779. æFp Dialogs.p
  12780. æT FUNCTION
  12781. æTN A97D
  12782. æD FUNCTION NewDialog(wStorage: Ptr;boundsRect: Rect;title: Str255;visible: BOOLEAN;
  12783.     procID: INTEGER;behind: WindowPtr;goAwayFlag: BOOLEAN;refCon: LONGINT;
  12784.     itmLstHndl: Handle): DialogPtr;
  12785.     INLINE $A97D;
  12786. æDT myVariable := NewDialog(wStorage,boundsRect,title,visible,procID,behind,goAwayFlag,refCon,itmLstHndl);
  12787. æMM
  12788. æRI I-412, P-107, 177
  12789. æC 
  12790. NewDialog creates a dialog as specified by its parameters and returns a pointer to
  12791. the new dialog. The first eight parameters (dStorage through refCon) are passed to
  12792. the Window Manager function NewWindow, which creates the dialog window; the meanings
  12793. of these parameters are summarized below. The items parameter is a handle to the
  12794. dialog’s item list. You can get the items handle by calling the Resource Manager to
  12795. read the item list from the resource file into memory.
  12796.  
  12797. Note:  Advanced programmers can create their own item lists in memory rather
  12798.        than have them read from a resource file. The exact format is given
  12799.        later under “Formats of Resources for Dialogs and Alerts”.
  12800.  
  12801. DStorage is analogous to the wStorage parameter of NewWindow; it’s a pointer to the
  12802. storage to use for the dialog record. If you pass NIL for dStorage, the dialog record
  12803. will be allocated in the heap (which, in the case of modeless dialogs, may cause the
  12804. heap to become fragmented).
  12805.  
  12806. BoundsRect, a rectangle given in global coordinates, determines the dialog window’s
  12807. size and location. It becomes the portRect of the window’s grafPort. Remember that
  12808. the top coordinate of this rectangle should be at least 25 points below the top of
  12809. the screen for a modal dialog, to allow for the menu bar and the border around the
  12810. portRect, and at least 40 points below the top of the screen for a modeless dialog,
  12811. to allow for the menu bar and the window’s title bar.
  12812.  
  12813. Title is the title of a modeless dialog box; pass the empty string for modal dialogs.
  12814.  
  12815. If the visible parameter is TRUE, the dialog window is drawn on the screen. If it’s
  12816. FALSE, the window is initially invisible and may later be shown with a call to the
  12817. Window Manager procedure ShowWindow.
  12818.  
  12819. Note:  NewDialog generates an update event for the entire window contents,
  12820.        so the items aren’t drawn immediately, with the exception of controls.
  12821.        The Dialog Manager calls the Control Manager to draw controls, and the
  12822.        Control Manager draws them immediately rather than via the standard
  12823.        update mechanism. Because of this, the Dialog Manager calls the Window
  12824.        Manager procedure ValidRect for the enclosing rectangle of each control,
  12825.        so the controls won’t be drawn twice. If you find that the other items
  12826.        aren’t being drawn soon enough after the controls, try making the
  12827.        window invisible initially and then calling ShowWindow to show it.
  12828.  
  12829. ProcID is the window definition ID, which leads to the window definition function for
  12830. this type of window. The window definition IDs for the standard types of dialog
  12831. window are dBoxProc for the modal type and documentProc for the modeless type.
  12832.  
  12833. The behind parameter specifies the window behind which the dialog window is to be
  12834. placed on the desktop. Pass POINTER(–1) to bring up the dialog window in front of all
  12835. other windows.
  12836.  
  12837. GoAwayFlag applies to modeless dialog boxes; if it’s TRUE, the dialog window has a
  12838. close box in its title bar when the window is active.
  12839.  
  12840. RefCon is the dialog window’s reference value, which the application may store into
  12841. and access for any purpose.
  12842.  
  12843. NewDialog sets the font of the dialog window’s grafPort to the system font or, if you
  12844. previously called SetDAFont, to the specified font. It also sets the window class in
  12845. the window record to dialogKind.
  12846.  
  12847. æKY GetNewDialog
  12848. æFp Dialogs.p
  12849. æT FUNCTION
  12850. æTN A97C
  12851. æD FUNCTION GetNewDialog(dialogID: INTEGER;dStorage: Ptr;behind: WindowPtr): DialogPtr;
  12852.     INLINE $A97C;
  12853. æDT myVariable := GetNewDialog(dialogID,dStorage,behind);
  12854. æMM
  12855. æRT 4,34
  12856. æRI I-413, V-284, N4-1,  P-107, 172
  12857. æC 
  12858. Like NewDialog (above), GetNewDialog creates a dialog as specified by its parameters
  12859. and returns a pointer to the new dialog. Instead of having the parameters boundsRect,
  12860. title, visible, procID, goAwayFlag, and refCon, GetNewDialog has a single dialogID
  12861. parameter, where dialogID is the resource ID of a dialog template that supplies the
  12862. same information as those parameters. The dialog template also contains the resource
  12863. ID of the dialog’s item list. After calling the Resource Manager to read the item
  12864. list into memory (if it’s not already in memory), GetNewDialog makes a copy of the
  12865. item list and uses that copy; thus you may have multiple independent dialogs whose
  12866. items have the same types, locations, and initial contents. The dStorage and behind
  12867. parameters of GetNewDialog have the same meaning as in NewDialog.
  12868.  
  12869. Warning:  If either the dialog template resource or the item list
  12870.           resource can’t be read, the function result is undefined.
  12871.  
  12872. Note:  GetNewDialog doesn’t release the memory occupied by the resources.
  12873.  
  12874. The GetNewDialog routine will attempt to load a 'dctb' resource and returns a pointer
  12875. to a color grafPort if the resource exists. If no 'dctb' resource is present, GetNewDialog
  12876. returns a pointer to an old grafPort.
  12877.  
  12878. The dialog color table is copied before it is passed to SetWinSize unless its ctSize
  12879. field is equal to –1, indicating that the default window colors are to be used instead.
  12880. The copy is made so that the color table resource can be purged without affecting the
  12881. dialog.
  12882.  
  12883. The color dialog item list resource is duplicated as well, so it can be purgeable.
  12884.  
  12885. æKY CloseDialog
  12886. æFp Dialogs.p
  12887. æT PROCEDURE
  12888. æTN A982
  12889. æD PROCEDURE CloseDialog(theDialog: DialogPtr);
  12890.     INLINE $A982;
  12891. æDT CloseDialog(theDialog);
  12892. æMM
  12893. æRI I-413, P-107, 167
  12894. æC 
  12895. CloseDialog removes theDialog’s window from the screen and deletes it from the window
  12896. list, just as when the Window Manager procedure CloseWindow is called. It releases
  12897. the memory occupied by the following:
  12898.  
  12899.   •  The data structures associated with the dialog window (such as the
  12900.      window’s structure, content, and update regions).
  12901.   •  All the items in the dialog (except for pictures and icons, which
  12902.      might be shared resources), and any data structures associated with
  12903.      them. For example, it would dispose of the region occupied by the
  12904.      thumb of a scroll bar, or a similar region for some other control
  12905.      in the dialog.
  12906.  
  12907. CloseDialog does not dispose of the dialog record or the item list. Figure 10 illustrates
  12908. the effect of CloseDialog (and DisposDialog, described below).
  12909.  
  12910. •••Refer to Figure 10.•••
  12911.  
  12912. Figure 10–CloseDialog and DisposDialog
  12913.  
  12914. Call CloseDialog when you’re done with a dialog if you supplied NewDialog or GetNewDialog
  12915. with a pointer to the dialog storage (in the dStorage parameter) when you created the
  12916. dialog.
  12917.  
  12918. Note:  Even if you didn’t supply a pointer to the dialog storage, you may
  12919.        want to call CloseDialog if you created the dialog with NewDialog.
  12920.        You would call CloseDialog if you wanted to keep the item list around
  12921.        (since, unlike GetNewDialog, NewDialog does not use a copy of the
  12922.        item list).
  12923.  
  12924. æKY DisposDialog
  12925. æFp Dialogs.p
  12926. æT PROCEDURE
  12927. æTN A983
  12928. æD PROCEDURE DisposDialog(theDialog: DialogPtr);
  12929.     INLINE $A983;
  12930. æDT DisposDialog(theDialog);
  12931. æRI I-415
  12932. æC 
  12933. DisposDialog calls CloseDialog (above) and then releases the memory occupied by the
  12934. dialog’s item list and dialog record. Call DisposDialog when you’re done with a
  12935. dialog if you let the dialog record be allocated in the heap when you created the
  12936. dialog (by passing NIL as the dStorage parameter to NewDialog or GetNewDialog).
  12937.  
  12938. æKY CouldDialog
  12939. æFp Dialogs.p
  12940. æT PROCEDURE
  12941. æTN A979
  12942. æD PROCEDURE CouldDialog(dialogID: INTEGER);
  12943.     INLINE $A979;
  12944. æDT CouldDialog(dialogID);
  12945. æMM
  12946. æRI I-415, V-284
  12947. æC 
  12948. CouldDialog makes the dialog template having the given resource ID unpurgeable
  12949. (reading it into memory if it’s not already there). It does the same for the dialog
  12950. window’s definition function, the dialog’s item list resource, and any items defined
  12951. as resources. This is useful if the dialog box may come up when the resource file
  12952. isn’t accessible, such as during a disk copy.
  12953.  
  12954. Warning:  CouldDialog assumes your dialogs use the system font; if you’ve
  12955.           changed the font with SetDAFont, calling CouldDialog doesn’t make
  12956.           the font unpurgeable.
  12957.  
  12958. The CouldDialog procedure makes the dialog color table template unpurgeable
  12959. (reading it into memory if it isn’t already there), if it exists. It does the same
  12960. for the dialog’s color item list, if it has one.
  12961.  
  12962. Warning:  CouldDialog doesn’t load or make 'FONT' or 'FOND' resources
  12963.           indicated in the color item list unpurgeable.
  12964.  
  12965. æKY FreeDialog
  12966. æFp Dialogs.p
  12967. æT PROCEDURE
  12968. æTN A97A
  12969. æD PROCEDURE FreeDialog(dialogID: INTEGER);
  12970.     INLINE $A97A;
  12971. æDT FreeDialog(dialogID);
  12972. æMM
  12973. æRI I-415, V-284
  12974. æC 
  12975. Given the resource ID of a dialog template previously specified in a call to CouldDialog,
  12976. FreeDialog undoes the effect of CouldDialog (by making the resources purgeable). It
  12977. should be called when there’s no longer a need to keep the resources in memory.
  12978.  
  12979. Given the resource ID of a dialog template previously specified in a call to CouldDialog,
  12980. the FreeDialog routine undoes the effect of CouldDialog, by restoring the original
  12981. purge state of the color table and color item list resources.
  12982.  
  12983. æKY ParamText
  12984. æFp Dialogs.p
  12985. æT PROCEDURE
  12986. æTN A98B
  12987. æD PROCEDURE ParamText(param0: Str255;param1: Str255;param2: Str255;param3: Str255);
  12988.     INLINE $A98B;
  12989. æDT ParamText(param0,param1,param2,param3);
  12990. æMM
  12991. æRI I-421
  12992. æC  
  12993. ParamText provides a means of substituting text in statText items:  param0 through
  12994. param3 will replace the special strings '^0' through '^3' in all statText items in
  12995. all subsequent dialog or alert boxes. Pass empty strings for parameters not used.
  12996.  
  12997. Assembly-language note:  Assembly-language programmers may pass NIL for
  12998.                          parameters not used or for strings that are not
  12999.                          to be changed.
  13000.  
  13001. For example, if the text is defined as 'Cannot open document ^0' and docName is a
  13002. string variable containing a document name that the user typed, you can call ParamText(docName,'
  13003. ',' ',' ')
  13004.  
  13005. Note:  All strings that may need to be translated to other languages should
  13006.        be stored in resource files.
  13007.  
  13008. Assembly-language note:  The Dialog Manager stores handles to the four
  13009.                          ParamText parameters in a global array named DAStrings.
  13010.  
  13011. æKY ModalDialog
  13012. æFp Dialogs.p
  13013. æT PROCEDURE
  13014. æTN A991
  13015. æD PROCEDURE ModalDialog(filterProc: ProcPtr;VAR itemHit: INTEGER);
  13016.     INLINE $A991;
  13017. æDT ModalDialog(filterProc,itemHit);
  13018. æMM
  13019. æRT 34, 203
  13020. æRI I-415, N34-2, 3,   P-108, 176
  13021. æC  
  13022. Call ModalDialog after creating a modal dialog and bringing up its window in the
  13023. frontmost plane. ModalDialog repeatedly gets and handles events in the dialog’s
  13024. window; after handling an event involving an enabled dialog item, it returns with the
  13025. item number in itemHit. Normally you’ll then do whatever is appropriate as a response
  13026. to an event in that item.
  13027.  
  13028. ModalDialog gets each event by calling the Toolbox Event Manager function GetNextEvent.
  13029. If the event is a mouse-down event outside the content region of the dialog window,
  13030. ModalDialog emits sound number 1 (which should be a single beep) and gets the next
  13031. event; otherwise, it filters and handles the event as described below.
  13032.  
  13033. Note:  Once before getting each event, ModalDialog calls SystemTask, a
  13034.        Desk Manager procedure that must be called regularly so that desk
  13035.        accessories will work properly.
  13036.  
  13037. The filterProc parameter determines how events are filtered. If it’s NIL, the standard
  13038. filterProc function is executed; this causes ModalDialog to return 1 in itemHit if
  13039. the Return key or Enter key is pressed. If filterProc isn’t NIL, ModalDialog filters
  13040. events by executing the function it points to. Your filterProc function should have
  13041. three parameters and return a Boolean value. For example, this is how it would be
  13042. declared if it were named MyFilter:
  13043.  
  13044. FUNCTION MyFilter (theDialog:  DialogPtr; VAR theEvent:  EventRecord;
  13045.                    VAR itemHit:  INTEGER) :  BOOLEAN;
  13046.  
  13047. A function result of FALSE tells ModalDialog to go ahead and handle the event, which
  13048. either can be sent through unchanged or can be changed to simulate a different event.
  13049. A function result of TRUE tells ModalDialog to return immediately rather than handle
  13050. the event; in this case, the filterProc function sets itemHit to the item number that
  13051. ModalDialog should return.
  13052.  
  13053. Note:  If you want it to be consistent with the standard filterProc function,
  13054.        your function should at least check whether the Return key or Enter
  13055.        key was pressed and, if so, return 1 in itemHit and a function result
  13056.        of TRUE.
  13057.  
  13058. You can use the filterProc function, for example, to treat a typed character in a
  13059. special way (such as ignore it, or make it have the same effect as another character
  13060. or as clicking a button); in this case, the function would test for a key-down event
  13061. with that character. As another example, suppose the dialog box contains a userItem
  13062. whose procedure draws a clock with the current time displayed. The filterProc function
  13063. can call that procedure and return FALSE without altering the current event.
  13064.  
  13065. Note:  ModalDialog calls GetNextEvent with a mask that excludes disk-inserted
  13066.        events. To receive disk-inserted events, your filterProc function can
  13067.        call GetNextEvent (or EventAvail) with a mask that accepts only that
  13068.        type of event.
  13069.  
  13070. ModalDialog handles the events for which the filterProc function returns FALSE as
  13071. follows:
  13072.  
  13073.   •  In response to an activate or update event for the dialog window,
  13074.      ModalDialog activates or updates the window.
  13075.   •  If the mouse button is pressed in an editText item, ModalDialog
  13076.      responds to the mouse activity as appropriate (displaying an insertion
  13077.      point or selecting text). If a key-down event occurs and there’s an
  13078.      editText item, text entry and editing are handled in the standard way
  13079.      for such items (except that if the Command key is down, ModalDialog
  13080.      responds as though it’s not). In either case, ModalDialog returns if
  13081.      the editText item is enabled or does nothing if it’s disabled. If a
  13082.      key-down event occurs when there’s no editText item, ModalDialog does
  13083.      nothing.
  13084.   •  If the mouse button is pressed in a control, ModalDialog calls the
  13085.      Control Manager function TrackControl. If the mouse button is released
  13086.      inside the control and the control is enabled, ModalDialog returns;
  13087.      otherwise, it does nothing.
  13088.   •  If the mouse button is pressed in any other enabled item in the
  13089.      dialog box, ModalDialog returns. If the mouse button is pressed in
  13090.      any other disabled item or in no item, or if any other event occurs,
  13091.      ModalDialog does nothing.
  13092.  
  13093. æKY IsDialogEvent
  13094. æFp Dialogs.p
  13095. æT FUNCTION
  13096. æTN A97F
  13097. æD FUNCTION IsDialogEvent(theEvent: EventRecord): BOOLEAN;
  13098.     INLINE $A97F;
  13099. æDT myVariable := IsDialogEvent(theEvent);
  13100. æRI I-416, N5-1, P-108, 175
  13101. æC  
  13102. If your application includes any modeless dialogs, call IsDialogEvent after calling
  13103. the Toolbox Event Manager function GetNextEvent.
  13104.  
  13105. Warning:  If your modeless dialog contains any editText items, you must call
  13106.           IsDialogEvent (and then DialogSelect) even if GetNextEvent returns
  13107.           FALSE; otherwise your dialog won’t receive null events and the
  13108.           caret won’t blink.
  13109.  
  13110. Pass the current event in theEvent. IsDialogEvent determines whether theEvent needs
  13111. to be handled as part of a dialog. If theEvent is an activate or update event for a
  13112. dialog window, a mouse-down event in the content region of an active dialog window,
  13113. or any other type of event when a dialog window is active, IsDialogEvent returns
  13114. TRUE; otherwise, it returns FALSE.
  13115.  
  13116. When FALSE is returned, just handle the event yourself like any other event that’s
  13117. not dialog-related. When TRUE is returned, you’ll generally end up passing the event
  13118. to DialogSelect for it to handle (as described below), but first you should do some
  13119. additional checking:
  13120.  
  13121.   •  DialogSelect doesn’t handle keyboard equivalents of commands. Check
  13122.      whether the event is a key-down event with the Command key held down
  13123.      and, if so, carry out the command if it’s one that applies when a
  13124.      dialog window is active. (If the command doesn’t so apply, do nothing.)
  13125.   •  In special cases, you may want to bypass DialogSelect or do some
  13126.      preprocessing before calling it. If so, check for those events and
  13127.      respond accordingly. You would need to do this, for example, if the
  13128.      dialog is to respond to disk-inserted events.
  13129.  
  13130. For cases other than these, pass the event to DialogSelect for it to handle.
  13131.  
  13132. æKY DialogSelect
  13133. æFp Dialogs.p
  13134. æT FUNCTION
  13135. æTN A980
  13136. æD FUNCTION DialogSelect(theEvent: EventRecord;VAR theDialog: DialogPtr;VAR itemHit: INTEGER): BOOLEAN;
  13137.     INLINE $A980;
  13138. æDT myVariable := DialogSelect(theEvent,theDialog,itemHit);
  13139. æMM
  13140. æRT 34
  13141. æRI I-417, N34-3, P-108, 168
  13142. æC 
  13143. You’ll normally call DialogSelect when IsDialogEvent returns TRUE, passing in theEvent
  13144. an event that needs to be handled as part of a modeless dialog. DialogSelect handles
  13145. the event as described below. If the event involves an enabled dialog item, DialogSelect
  13146. returns a function result of TRUE with the dialog pointer in theDialog and the item
  13147. number in itemHit; otherwise, it returns FALSE with theDialog and itemHit undefined.
  13148. Normally when DialogSelect returns TRUE, you’ll do whatever is appropriate as a
  13149. response to the event, and when it returns FALSE you’ll do nothing.
  13150.  
  13151. If the event is an activate or update event for a dialog window, DialogSelect activates
  13152. or updates the window and returns FALSE.
  13153.  
  13154. If the event is a mouse-down event in an editText item, DialogSelect responds as
  13155. appropriate (displaying a caret at the insertion point or selecting text). If it’s a
  13156. key-down or auto-key event and there’s an editText item, text entry and editing are
  13157. handled in the standard way. In either case, DialogSelect returns TRUE if the editText
  13158. item is enabled or FALSE if it’s disabled. If a key-down or auto-key event is passed
  13159. when there’s no editText item, DialogSelect returns FALSE.
  13160.  
  13161. Note:  For a keyboard event, DialogSelect doesn’t check to see whether the
  13162.        Command key is held down; to handle keyboard equivalents of commands,
  13163.        you have to check for them before calling DialogSelect. Similarly, to
  13164.        treat a typed character in a special way (such as ignore it, or make
  13165.        it have the same effect as another character or as clicking a button),
  13166.        you need to check for a key-down event with that character before
  13167.        calling DialogSelect.
  13168.  
  13169. If the event is a mouse-down event in a control, DialogSelect calls the Control
  13170. Manager function TrackControl. If the mouse button is released inside the control and
  13171. the control is enabled, DialogSelect returns TRUE; otherwise, it returns FALSE.
  13172.  
  13173. If the event is a mouse-down event in any other enabled item, DialogSelect returns
  13174. TRUE. If it’s a mouse-down event in any other disabled item or in no item, or if it’s
  13175. any other event, DialogSelect returns FALSE.
  13176.  
  13177. Note:  If the event isn’t one that DialogSelect specifically checks for (if
  13178.        it’s a null event, for example), and there’s an editText item in the
  13179.        dialog, DialogSelect calls the TextEdit procedure TEIdle to make the
  13180.        caret blink.
  13181.  
  13182. æKY DrawDialog
  13183. æFp Dialogs.p
  13184. æT PROCEDURE
  13185. æTN A981
  13186. æD PROCEDURE DrawDialog(theDialog: DialogPtr);
  13187.     INLINE $A981;
  13188. æDT DrawDialog(theDialog);
  13189. æMM
  13190. æRI I-418
  13191. æC 
  13192. DrawDialog draws the contents of the given dialog box. Since DialogSelect and ModalDialog
  13193. handle dialog window updating, this procedure is useful only in unusual situations.
  13194. You would call it, for example, to display a dialog box that doesn’t require any
  13195. response but merely tells the user what’s going on during a time-consuming process.
  13196.  
  13197. æKY UpdtDialog
  13198. æFp Dialogs.p
  13199. æT PROCEDURE
  13200. æTN A978
  13201. æD PROCEDURE UpdtDialog(theDialog: DialogPtr;updateRgn: RgnHandle);
  13202.     INLINE $A978;
  13203. æDT UpdtDialog(theDialog,updateRgn);
  13204. æMM
  13205. æRI IV-60
  13206. æC  
  13207. UpdtDialog is a faster version of the DrawDialog procedure. Instead of drawing the
  13208. entire contents of the given dialog box, UpdtDialog draws only the items that are in
  13209. a specified update region. UpdtDialog is called in response to an update event, and
  13210. is usually bracketed by calls to the Window Manager procedures BeginUpdate and EndUpdate.
  13211. UpdateRgn should be set to the visRgn of theWindow’s port. (For more details, see the
  13212. BeginUpdate procedure in the Window Manager chapter.)
  13213.  
  13214. æKY Alert
  13215. æFp Dialogs.p
  13216. æT FUNCTION
  13217. æTN A985
  13218. æD FUNCTION Alert(alertID: INTEGER;filterProc: ProcPtr): INTEGER;
  13219.     INLINE $A985;
  13220. æDT myVariable := Alert(alertID,filterProc);
  13221. æMM
  13222. æRI I-418, V-284
  13223. æC 
  13224. This function invokes the alert defined by the alert template that has the given
  13225. resource ID. It calls the current sound procedure, if any, passing it the sound
  13226. number specified in the alert template for this stage of the alert. If no alert box
  13227. is to be drawn at this stage, Alert returns a function result of –1; otherwise, it
  13228. creates and displays the alert window for this alert and draws the alert box.
  13229.  
  13230. Warning:  If the alert template resource can’t be read, the function result
  13231.           is undefined.
  13232.  
  13233. Note:  Alert creates the alert window by calling NewDialog, and does the
  13234.        rest of its processing by calling ModalDialog.
  13235.  
  13236. Alert repeatedly gets and handles events in the alert window until an enabled item is
  13237. clicked, at which time it returns the item number. Normally you’ll then do whatever
  13238. is appropriate in response to a click of that item.
  13239.  
  13240. Alert gets each event by calling the Toolbox Event Manager function GetNextEvent. If
  13241. the event is a mouse-down event outside the content region of the alert window, Alert
  13242. emits sound number 1 (which should be a single beep) and gets the next event; otherwise,
  13243. it filters and handles the event as described below.
  13244.  
  13245. The filterProc parameter has the same meaning as in ModalDialog (see above). If it’s
  13246. NIL, the standard filterProc function is executed, which makes the Return key or the
  13247. Enter key have the same effect as clicking the default button. If you specify your
  13248. own filterProc function and want to retain this feature, you must include it in your
  13249. function. You can find out what the current default button is by looking at the
  13250. aDefItem field of the dialog record for the alert
  13251. (via the dialog pointer passed to the function).
  13252.  
  13253. Alert handles the events for which the filterProc function returns FALSE as follows:
  13254.  
  13255.   •  If the mouse button is pressed in a control, Alert calls the Control
  13256.      Manager procedure TrackControl. If the mouse button is released inside
  13257.      the control and the control is enabled, Alert returns; otherwise, it
  13258.      does nothing.
  13259.   •  If the mouse button is pressed in any other enabled item, Alert simply
  13260.      returns. If it’s pressed in any other disabled item or in no item, or
  13261.      if any other event occurs, Alert does nothing.
  13262.  
  13263. Before returning to the application with the item number, Alert removes the alert box
  13264. from the screen. (It disposes of the alert window and its associated data structures,
  13265. the item list, and the items.)
  13266.  
  13267. Note:  When an alert is removed, if it was overlapping the default button
  13268.        of a previous alert, that button’s bold outline won’t be redrawn.
  13269.  
  13270. Note:  The Alert function’s removal of the alert box would not be the
  13271.        desired result if the user clicked a check box or radio button;
  13272.        however, normally alerts contain only static text, icons, pictures,
  13273.        and buttons that are supposed to make the alert box go away. If your
  13274.        alert contains other items besides these, consider whether it might
  13275.        be more appropriate as a dialog.
  13276.  
  13277. The Alert function looks for a resource of type 'actb' with the same ID as the alert.
  13278. The alert color table is copied before it is passed to SetWinSize unless its ctSize
  13279. field is equal to –1, indicating that the default window colors are to be used instead.
  13280. The copy is made so that the color table resource can be purged without affecting the
  13281. alert.
  13282.  
  13283. The color dialog item list resource is duplicated as well, so it can be purgeable.
  13284.  
  13285. æKY StopAlert
  13286. æFp Dialogs.p
  13287. æT FUNCTION
  13288. æTN A986
  13289. æD FUNCTION StopAlert(alertID: INTEGER;filterProc: ProcPtr): INTEGER;
  13290.     INLINE $A986;
  13291. æDT myVariable := StopAlert(alertID,filterProc);
  13292. æMM
  13293. æRI I-419, V-284, P-109, 182
  13294. æC  
  13295. StopAlert is the same as the Alert function (above) except that before drawing the
  13296. items of the alert in the alert box, it draws the Stop icon in the top left corner of
  13297. the box (within the rectangle (10,20)(42,52)). The Stop icon has the following resource
  13298. ID:
  13299.  
  13300. CONST stopIcon = 0;
  13301.  
  13302. If the application’s resource file doesn’t include an icon with that ID number, the
  13303. Dialog Manager uses the standard Stop icon in the system resource file (see Figure
  13304. 11).
  13305.  
  13306. The calls CautionAlert, StopAlert, and NoteAlert look for a resource of type
  13307. 'actb' with the same ID as the alert.
  13308.  
  13309. •••Refer to Figure 11.•••
  13310.  
  13311. Figure 11–Standard Alert Icons
  13312.  
  13313. æKY NoteAlert
  13314. æFp Dialogs.p
  13315. æT FUNCTION
  13316. æTN A987
  13317. æD FUNCTION NoteAlert(alertID: INTEGER;filterProc: ProcPtr): INTEGER;
  13318.     INLINE $A987;
  13319. æDT myVariable := NoteAlert(alertID,filterProc);
  13320. æMM
  13321. æRI I-420
  13322. æC  
  13323. NoteAlert is like StopAlert except that it draws the Note icon, which has the following
  13324. resource ID:
  13325.  
  13326. CONST noteIcon = 1;
  13327.  
  13328. The calls CautionAlert, StopAlert, and NoteAlert look for a resource of type
  13329. 'actb' with the same ID as the alert.
  13330.  
  13331. æKY CautionAlert
  13332. æFp Dialogs.p
  13333. æT FUNCTION
  13334. æTN A988
  13335. æD FUNCTION CautionAlert(alertID: INTEGER;filterProc: ProcPtr): INTEGER;
  13336.     INLINE $A988;
  13337. æDT myVariable := CautionAlert(alertID,filterProc);
  13338. æMM
  13339. æRI I-420
  13340. æC  
  13341. CautionAlert is like StopAlert except that it draws the Caution icon, which has the
  13342. following resource ID:
  13343.  
  13344. CONST cautionIcon = 2;
  13345.  
  13346. The calls CautionAlert, StopAlert, and NoteAlert look for a resource of type
  13347. 'actb' with the same ID as the alert.
  13348.  
  13349. æKY CouldAlert
  13350. æFp Dialogs.p
  13351. æT PROCEDURE
  13352. æTN A989
  13353. æD PROCEDURE CouldAlert(alertID: INTEGER);
  13354.     INLINE $A989;
  13355. æDT CouldAlert(alertID);
  13356. æMM
  13357. æRI I-420, V-285
  13358. æC 
  13359. CouldAlert makes the alert template having the given resource ID unpurgeable
  13360. (reading it into memory if it’s not already there). It does the same for the alert
  13361. window’s definition function, the alert’s item list resource, and any items defined
  13362. as resources. This is useful if the alert may occur when the resource file isn’t
  13363. accessible, such as during a disk copy.
  13364.  
  13365. Warning:  Like CouldDialog, CouldAlert assumes your alerts use the system
  13366.           font; if you’ve changed the font with SetDAFont, calling CouldAlert
  13367.           doesn’t make the font unpurgeable.
  13368.  
  13369. The CouldAlert routine makes the alert color table template unpurgeable
  13370. (reading it into memory if it isn’t already there), if it exists. It does the same
  13371. for the alert’s color item list, if it has one.
  13372.  
  13373. Warning:  Like CouldDialog, CouldAlert doesn’t load or make 'FONT' or
  13374.           'FOND' resources indicated in the color item list unpurgeable.
  13375.  
  13376. æKY FreeAlert
  13377. æFp Dialogs.p
  13378. æT PROCEDURE
  13379. æTN A98A
  13380. æD PROCEDURE FreeAlert(alertID: INTEGER);
  13381.     INLINE $A98A;
  13382. æDT FreeAlert(alertID);
  13383. æMM
  13384. æRI I-420, V-285
  13385. æC 
  13386. Given the resource ID of an alert template previously specified in a call to CouldAlert,
  13387. FreeAlert undoes the effect of CouldAlert (by making the resources purgeable). It
  13388. should be called when there’s no longer a need to keep the resources in memory.
  13389.  
  13390. Given the resource ID of an alert template previously specified in a call to CouldAlert,
  13391. the FreeAlert routine undoes the effect of CouldAlert, by restoring the original
  13392. purge state of the color table and color item list resources.
  13393.  
  13394. æKY GetDItem
  13395. æFp Dialogs.p
  13396. æT PROCEDURE
  13397. æTN A98D
  13398. æD PROCEDURE GetDItem(theDialog: DialogPtr;itemNo: INTEGER;VAR itemType: INTEGER;
  13399.     VAR item: Handle;VAR box: Rect);
  13400.     INLINE $A98D;
  13401. æDT GetDItem(theDialog,itemNo,itemType,item,box);
  13402. æMM
  13403. æRI I-421
  13404. æC  
  13405. GetDItem returns in its VAR parameters the following information about the item
  13406. numbered itemNo in the given dialog’s item list:  In the itemType parameter, the item
  13407. type; in the item parameter, a handle to the item (or, for item type userItem, the
  13408. procedure pointer); and in the box parameter, the display rectangle for the item.
  13409.  
  13410. Suppose, for example, that you want to change the title of a control in a dialog box.
  13411. You can get the item handle with GetDItem, coerce it to type ControlHandle, and call
  13412. the Control Manager procedure SetCTitle to change the title. Similarly, to move the
  13413. control or change its size, you would call MoveControl or SizeControl.
  13414.  
  13415. Note:  To access the text of a statText or editText item, you can pass the
  13416.        handle returned by GetDItem to GetIText or SetIText (see below).
  13417.  
  13418. æKY SetDItem
  13419. æFp Dialogs.p
  13420. æT PROCEDURE
  13421. æTN A98E
  13422. æD PROCEDURE SetDItem(theDialog: DialogPtr;itemNo: INTEGER;itemType: INTEGER;
  13423.     item: Handle;box: Rect);
  13424.     INLINE $A98E;
  13425. æDT SetDItem(theDialog,itemNo,itemType,item,box);
  13426. æMM
  13427. æRT 34
  13428. æRI I-421, N34-1
  13429. æC  
  13430. SetDItem sets the item numbered itemNo in the given dialog’s item list, as specified
  13431. by the parameters (without drawing the item). The itemType parameter is the item
  13432. type; the item parameter is a handle to the item (or, for item type userItem, the
  13433. procedure pointer); and the box parameter is the display rectangle for the item.
  13434.  
  13435. Consider, for example, how to install an item of type userItem in a dialog:  In the
  13436. item list in the resource file, define an item in which the type is set to userItem
  13437. and the display rectangle to (0,0)(0,0). Specify that the dialog window be invisible
  13438. (in either the dialog template or the NewDialog call). After creating the dialog,
  13439. coerce the item’s procedure pointer to type Handle; then call SetDItem, passing that
  13440. handle and the display rectangle for the item. Finally, call the Window Manager
  13441. procedure ShowWindow to display the dialog window.
  13442.  
  13443. Note:  Do not use SetDItem to change the text of a statText or editText item
  13444.        or to change or move a control. See the description of GetDItem above
  13445.        for more information.
  13446.  
  13447. æKY HideDItem
  13448. æFp Dialogs.p
  13449. æT PROCEDURE
  13450. æTN A827
  13451. æD PROCEDURE HideDItem(theDialog: DialogPtr;itemNo: INTEGER);
  13452.     INLINE $A827;
  13453. æDT HideDItem(theDialog,itemNo);
  13454. æMM
  13455. æRI IV-59
  13456. æC 
  13457. HideDItem hides the item numbered itemNo in the given dialog’s item list by giving
  13458. the item a display rectangle that’s off the screen. (Specifically, if the left coordinate
  13459. of the item’s display rectangle is less than 8192, ShowDItem adds 16384 to both the
  13460. left and right coordinates the rectangle.) If the item is already hidden (that is, if
  13461. the left coordinate is greater than 8192), HideDItem does nothing.
  13462.  
  13463. HideDItem calls the EraseRect procedure on the item’s enclosing rectangle and adds
  13464. the rectangle that contained the item (not necessarily the item’s display rectangle)
  13465. to the update region. If the specified item is an active editText item, the item is
  13466. first deactivated (by calling TEDeactivate).
  13467.  
  13468. Note:  If you have items that are close to each other, be aware that the
  13469.        Dialog Manager draws outside of the enclosing rectangle by 3 pixels
  13470.        for editText items and by 4 pixels for a default button.
  13471.  
  13472. An item that’s been hidden by HideDItem can be redisplayed by the ShowDItem procedure.
  13473.  
  13474. Note:  To create a hidden item in a dialog item list, simply add 16384 to
  13475.        the left and right coordinates of the display rectangle.
  13476.  
  13477. æKY ShowDItem
  13478. æFp Dialogs.p
  13479. æT PROCEDURE
  13480. æTN A828
  13481. æD PROCEDURE ShowDItem(theDialog: DialogPtr;itemNo: INTEGER);
  13482.     INLINE $A828;
  13483. æDT ShowDItem(theDialog,itemNo);
  13484. æMM
  13485. æRI IV-59
  13486. æC 
  13487. ShowDItem redisplays the item numbered itemNo, previously hidden by HideDItem, by
  13488. giving the item the display rectangle it had prior to the HideDItem call.
  13489. (Specifically, if the left coordinate of the item’s display rectangle is greater than
  13490. 8192, ShowDItem subtracts 16384 from both the left and right coordinates of the rectangle.)
  13491. If the item is already visible (that is, if the left coordinate is less than 8192),
  13492. ShowDItem does nothing.
  13493.  
  13494. ShowDItem adds the rectangle that contained the item (not necessarily the
  13495. item’s display rectangle) to the update region so that it will be drawn. If the item
  13496. becomes the only editText item, ShowDItem activates it (by calling TEActivate).
  13497.  
  13498. æKY SelIText
  13499. æFp Dialogs.p
  13500. æT PROCEDURE
  13501. æTN A97E
  13502. æD PROCEDURE SelIText(theDialog: DialogPtr;itemNo: INTEGER;strtSel: INTEGER;
  13503.     endSel: INTEGER);
  13504.     INLINE $A97E;
  13505. æDT SelIText(theDialog,itemNo,strtSel,endSel);
  13506. æMM
  13507. æRI I-422, P-110
  13508. æC 
  13509. Given a pointer to a dialog and the item number of an editText item in the dialog
  13510. box, SelIText does the following:
  13511.  
  13512.   •  If the item contains text, SelIText sets the selection range to extend
  13513.      from character position strtSel up to but not including character
  13514.      position endSel. The selection range is inverted unless strtSel equals
  13515.      endSel, in which case a blinking vertical bar is displayed to indicate
  13516.      an insertion point at that position.
  13517.   •  If the item doesn’t contain text, SelIText simply displays the insertion
  13518.      point.
  13519.  
  13520. For example, if the user makes an unacceptable entry in the editText item, the application
  13521. can put up an alert box reporting the problem and then select the entire text of the
  13522. item so it can be replaced by a new entry. (Without this procedure, the user would
  13523. have to select the item before making the new entry.)
  13524.  
  13525. Note:  You can select the entire text by specifying 0 for strtSel and 32767
  13526.        for endSel. For details about selection range and character position,
  13527.        see the TextEdit chapter.
  13528.  
  13529. æKY GetIText
  13530. æFp Dialogs.p
  13531. æT PROCEDURE
  13532. æTN A990
  13533. æD PROCEDURE GetIText(item: Handle;VAR text: Str255);
  13534.     INLINE $A990;
  13535. æDT GetIText(item,text);
  13536. æRT 18
  13537. æRI I-422, N18-2
  13538. æC  
  13539. Given a handle to a statText or editText item in a dialog box, as returned by GetDItem,
  13540. GetIText returns the text of the item in the text parameter. (If the user typed more
  13541. than 255 characters in an editText item, GetIText returns only the first 255.)
  13542.  
  13543. æKY SetIText
  13544. æFp Dialogs.p
  13545. æT PROCEDURE
  13546. æTN A98F
  13547. æD PROCEDURE SetIText(item: Handle;text: Str255);
  13548.     INLINE $A98F;
  13549. æDT SetIText(item,text);
  13550. æMM
  13551. æRI I-422
  13552. æC 
  13553. Given a handle to a statText or editText item in a dialog box, as returned by GetDItem,
  13554. SetIText sets the text of the item to the specified text and draws the item. For
  13555. example, suppose the exact content of a dialog’s text item cannot be determined until
  13556. the application is running, but the display rectangle is defined in the resource
  13557. file:  Call GetDItem to get a handle to the item, and call SetIText with the desired
  13558. text.
  13559.  
  13560. æKY FindDItem
  13561. æFp Dialogs.p
  13562. æT FUNCTION
  13563. æTN A984
  13564. æD FUNCTION FindDItem(theDialog: DialogPtr;thePt: Point): INTEGER;
  13565.     INLINE $A984;
  13566. æDT myVariable := FindDItem(theDialog,thePt);
  13567. æMM
  13568. æRT 112
  13569. æRI IV-60, N112
  13570. æC 
  13571. FindDItem returns the item number of the item containing the point specified, in
  13572. local coordinates, by thePt. If the point doesn’t lie within the item’s rectangle,
  13573. FindDItem returns –1. If there are overlapping items, it returns the item number of
  13574. the first item in the list containing the point. FindDItem is useful for changing the
  13575. cursor when it’s over a particular item.
  13576.  
  13577. Note:  FindDItem will return the item number of disabled items as well.
  13578.  
  13579. æKY NewCDialog
  13580. æFp Dialogs.p
  13581. æT FUNCTION
  13582. æTN AA4B
  13583. æD FUNCTION NewCDialog(dStorage: Ptr;boundsRect: Rect;title: Str255;visible: BOOLEAN;
  13584.     procID: INTEGER;behind: WindowPtr;goAwayFlag: BOOLEAN;refCon: LONGINT;
  13585.     items: Handle): DialogPtr;
  13586.     INLINE $AA4B;
  13587. æDT myVariable := NewCDialog(dStorage,boundsRect,title,visible,procID,behind,goAwayFlag,refCon,items);
  13588. æMM
  13589. æRI V-283
  13590. æC 
  13591. A new Dialog Manager routine has been added to support color dialogs: NewCDialog. 
  13592. Its parameters are identical to NewDialog, except that a cGrafPort is allocated
  13593. through a NewCWindow call instead of a call to NewWindow.
  13594.  
  13595. NewCDialog creates a dialog box as specified by its parameters and returns a cDialogPtr
  13596. to the new dialog. The first eight parameters (dStorage through refCon) are passed to
  13597. the Window Manager function NewCWindow, which creates the dialog window. The items
  13598. parameter is a handle to the dialog’s item list. You can get the items handle by
  13599. calling the Resource Manager to read the item list from the resource file into memory.
  13600.  
  13601. After calling NewCDialog, you can use SetWinColor to add a color table to the dialog.
  13602. This creates an auxiliary window record (auxWinRec) for the dialog window. You can
  13603. access this record with the GetAuxWin routine. The dialogCItem handle within the
  13604. auxWinRec points to the dialog item color table.
  13605.  
  13606. If the dialog’s content color isn’t white, it’s a good idea to call NewCDialog with
  13607. the visible flag set to FALSE. After the color table and color item list are installed,
  13608. use ShowWindow to display the dialog if the dialog is the frontmost window. If the
  13609. dialog is not in front, use ShowHide to display the dialog.
  13610.  
  13611. æKY GetAlrtStage
  13612. æFp Dialogs.p
  13613. æT FUNCTION
  13614. æD FUNCTION GetAlrtStage: INTEGER;
  13615.     INLINE $3EB8,$0A9A;
  13616. æDT myVariable := GetAlrtStage(paramList);
  13617. æRI I-422
  13618. æC  
  13619. GetAlrtStage returns the stage of the last occurrence of an alert, as a number from 0
  13620. to 3.
  13621.  
  13622. Assembly-language note:  Assembly-language programmers can get this number
  13623.                          by accessing the global variable ACount. In addition,
  13624.                          the global variable ANumber contains the resource ID
  13625.                          of the alert template of the last alert that occurred.
  13626.  
  13627. æKY ResetAlrtStage
  13628. æFp Dialogs.p
  13629. æT PROCEDURE
  13630. æD PROCEDURE ResetAlrtStage;
  13631.     INLINE $4278,$0A9A;
  13632. {     ResetAlrtStage resets the stage of the last occurrence of an alert
  13633. so that the next occurrenct of the same alert will be treatd as its
  13634. first stage. This is useful, for example, when you've used ParamText
  13635. to change the text of an alert such that from the user's point of view
  13636. it's a different alert.
  13637.  }
  13638. æDT ResetAlrtStage(paramList);
  13639. æRI I-423
  13640. æC 
  13641. ResetAlrtStage resets the stage of the last occurrence of an alert so that the next
  13642. occurrence of that same alert will be treated as its first stage. This is useful, for
  13643. example, when you’ve used ParamText to change the text of an alert such that from the
  13644. user’s point of view it’s a different alert.
  13645.  
  13646. Assembly-language note:  Assembly-language programmers can set the global
  13647.                          variable ACount to –1 for the same effect.
  13648.  
  13649. æKY DlgCut
  13650. æFp Dialogs.p
  13651. æT PROCEDURE
  13652. æD PROCEDURE DlgCut(theDialog: DialogPtr);
  13653. æDT DlgCut(theDialog);
  13654. æRT 215
  13655. æRI I-418, P-110
  13656. æC 
  13657. [Not in ROM]
  13658. DlgCut checks whether theDialog has any editText items and, if so, applies the TextEdit
  13659. procedure TECut to the currently selected editText item. (If the dialog record’s
  13660. editField is 0 or greater, DlgCut passes the contents of the textH field to TECut.)
  13661. You can call DlgCut to handle the editing command Cut when a modeless dialog window
  13662. is active.
  13663.  
  13664. Assembly-language note:  Assembly-language programmers can just read the
  13665.                          dialog record’s fields and call TextEdit directly.
  13666.  
  13667. æKY DlgPaste
  13668. æFp Dialogs.p
  13669. æT PROCEDURE
  13670. æD PROCEDURE DlgPaste(theDialog: DialogPtr);
  13671. æDT DlgPaste(theDialog);
  13672. æMM
  13673. æRT 215
  13674. æRI I-418, P-110
  13675. æC  
  13676. [Not in ROM]
  13677.  
  13678. DlgPaste is the same as DlgCut (above) except that it calls TEPaste, for handling the
  13679. Paste command.
  13680.  
  13681. æKY DlgCopy
  13682. æFp Dialogs.p
  13683. æT PROCEDURE
  13684. æD PROCEDURE DlgCopy(theDialog: DialogPtr);
  13685. æDT DlgCopy(theDialog);
  13686. æMM
  13687. æRT 215
  13688. æRI I-418, P-110
  13689. æC 
  13690. [Not in ROM]
  13691. DlgCopy is the same as DlgCut (above) except that it calls TECopy, for handling the
  13692. Copy command.
  13693.  
  13694. æKY DlgDelete
  13695. æFp Dialogs.p
  13696. æT PROCEDURE
  13697. æD PROCEDURE DlgDelete(theDialog: DialogPtr);
  13698. æDT DlgDelete(theDialog);
  13699. æMM
  13700. æRT 215
  13701. æRI I-418, P-110
  13702. æC  
  13703. [Not in ROM]
  13704.  
  13705. DlgDelete is the same as DlgCut (above) except that it calls TEDelete, for handling
  13706. the Clear command.
  13707.  
  13708. æKY SetDAFont
  13709. æFp Dialogs.p
  13710. æT PROCEDURE
  13711. æD PROCEDURE SetDAFont(fontNum: INTEGER);
  13712. æDT SetDAFont(fontNum);
  13713. æRI I-412
  13714. æC 
  13715. For subsequently created dialogs and alerts, SetDAFont causes the font of the dialog
  13716. or alert window’s grafPort to be set to the font having the specified font number. If
  13717. you don’t call this procedure, the system font is used. SetDAFont affects statText
  13718. and editText items but not titles of controls, which are always in the system font.
  13719.  
  13720. Assembly-language note:  Assembly-language programmers can simply set
  13721.                          the global variable DlgFont to the desired font number.
  13722.  
  13723.  
  13724. æKY DisAsmLookup.p
  13725. æKL Disassembler
  13726. endOfModule
  13727. InitLookup
  13728. Lookup
  13729. LookupTrapName
  13730. ModifyOperand
  13731. showMacsBugSymbol
  13732. validMacsBugSymbol
  13733.  
  13734. DisAsmStr80
  13735. LookupRegs
  13736. _A0_
  13737. _A1_
  13738. _A2_
  13739. _A3_
  13740. _A4_
  13741. _A5_
  13742. _A6_
  13743. _A7_
  13744. _ABS_
  13745. _PC_
  13746. _TRAP_
  13747.  
  13748. æKY DisAsmStr80
  13749. æFp DisAsmLookup.p
  13750. æT TYPE
  13751. æD DisAsmStr80 = String[80];
  13752.  
  13753. æKY Disassembler
  13754. æFp DisAsmLookup.p
  13755. æT PROCEDURE
  13756. æD PROCEDURE Disassembler(DstAdjust: LONGINT;VAR BytesUsed: INTEGER;FirstByte: UNIV Ptr;
  13757.     VAR Opcode: UNIV DisAsmStr80;VAR Operand: UNIV DisAsmStr80;VAR Comment: UNIV DisAsmStr80;
  13758.     LookUpProc: UNIV Ptr);
  13759. æDT Disassembler(DstAdjust,BytesUsed,FirstByte,Opcode,Operand,Comment,LookUpProc);
  13760. æC 
  13761. (*
  13762. Disassembler is a Pascal routine to be called to disassemble a sequence of
  13763. bytes.  All MC68xxx, MC68881, and MC68851 instructions are supported.  The
  13764. sequence of bytes to be disassembled are pointed to by FirstByte.  BytesUsed
  13765. bytes starting at FirstByte are consumed by the disassembly, and the Opcode,
  13766. Operand, and Comment strings returned as NULL TERMINATED Pascal strings (for
  13767. easier manipulation with C).  The caller is then free to format or use the
  13768. output strings any way appropriate to the application.
  13769.  
  13770. Depending on the opcode and effective address(s) (EA's) to be disassembled,
  13771. the Opcode, Operand, and Comment strings contain the following information:
  13772.  
  13773. Case                     Opcode    Operand    Comment
  13774. =======================================================================
  13775. Non PC-relative EA's     op.sz     EA's
  13776. PC-relative EA's         op.sz     EA's       ; address
  13777. Toolbox traps            DC.W      $AXXX      ; TB XXXX
  13778. OS traps                 DC.W      $AXXX      ; OS XXXX
  13779. Invalid bytes            DC.W      $XXXX      ; ????
  13780. Invalid byte #immediate  DC.W      $XXXX,...  ; op.sz #$??XX,EA
  13781. =======================================================================
  13782.  
  13783. For valid disassembly of processor instructions the appropriate MC68XXX
  13784. opcode mnemonic is generated for the Opcode string along with a size
  13785. attribute when required. The source and destination EA's are generated as the
  13786. Operand along with a possible comment.  Comments start with a ';'.  Traps use
  13787. a DC.W assembler directive as the Opcode with the trap word as the Operand
  13788. and a comment indicating whether the trap is a toolbox or OS trap and what
  13789. the trap number is.  As described later the caller can generate symbolic
  13790. substitutions into EA's and provide names for traps.
  13791.  
  13792. Invalid instructions cause the string 'DC.W' to be returned in the Opcode
  13793. string. Operand is '$XXXX' (the invalid word) with a comment of '; ????'.
  13794. BytesUsed is 2. This is similar to the trap call case except for the comment.
  13795.  
  13796. A special case is made for immediate byte operands with a nonzero high order
  13797. byte.  For example, the bytes $020011FF, when actually executed, would be
  13798. interpreted as ANDI.B $FF,D0. The processor will IGNORE the high order byte
  13799. of the immediate data! Thus, the bytes may be considered as valid.  Since the
  13800. Disassembler has no way of knowing the context in which it is disassembling,
  13801. it returns the Opcode as 'DC.W' as in the normal invalid case.  However, the
  13802. Operand string shows ALL the words disassembled separated with commas and
  13803. places the possibly valid disassembly in the Operand's comment indicating the
  13804. nonzero bytes. Thus for the example $020011FF bytes, the Opcode will be
  13805. 'DC.W', the Operand will be '$0200,$11FF', and the Comment 
  13806. '; ANDI.B #$??FF,D0'.  BytesUsed in this case would be 4.
  13807.  
  13808. Note, the Operand EA's is syntatically similar to but NOT COMPATIBLE with the
  13809. MPW assembler!  This is because the Disassembler generates byte hex constants
  13810. as "$XX" and word hex constants as "$XXXX".  Negative values (e.g., $FF or
  13811. $FFFF) produced by the Disassembler are treated as long word values by the MPW
  13812. assembler.  Thus it is assumed that Disassembler output will NOT be used as
  13813. MPW assembler input. If that is the goal, then the caller must convert strings
  13814. of the form $XX or $XXXX in the Operand string to their decimal equivalent.
  13815. The routine ModifyOperand is provided in this unit to aid with the conversion
  13816. process.
  13817.  
  13818. Since a PC-relative comment is an address, the only address that the
  13819. Disassembler knows about is the address of the code pointed to by FirstByte.
  13820. Generally, that may be a buffer that has no relation to "reality", i.e., the
  13821. actual code loaded into the buffer.  Therefore, to allow the address comment
  13822. to be mapped back to some actual address the caller may specify an adjustment
  13823. factor, specified by DstAdjust that is ADDED to the value that normally would
  13824. be placed in the comment.
  13825.  
  13826. Operand effective address strings are generated as a function of the 
  13827. effective address mode and a special case is made for A-trap opcode strings.
  13828. In places where a possible symbolic reference could be substituted for an
  13829. address (or a portion of an address), the Disassembler can call a user
  13830. specified routine to do the substitution (using th LookupProc parameter
  13831. described later).  The following table summarizes the generated effective
  13832. addresses and where symbolic substitutions (S) can be made:
  13833.      
  13834. Mode    Generated Effective Address  Effective Address with Substitution
  13835. ========================================================================
  13836.   0     Dn                           Dn
  13837.   1     An                           An
  13838.   2     (An)                         (An)
  13839.   3     (An)+                        (An)+
  13840.   4     -(An)                        -(An)
  13841.   5     ∂(An)                        S(An) or just S (if An=A5, ∂≥0)
  13842.  6n     ∂(An,Xn.Size*Scale)          S(An,Xn.Size*Scale)
  13843.  6n     (BD,An,Xn.Size*Scale)        (S,An,Xn.Size*Scale)
  13844.  6n     ([BD,An],Xm.Size*Scale,OD)   ([S,An],Xm.Size*Scale,OD)
  13845.  6n     ([BD,An,Xn.Size*Scale],OD)   ([S,An,Xn.Size*Scale],OD)
  13846.  70     ∂                            S
  13847.  71     ∂                            S
  13848.  72     *±∂                          S
  13849.  73     *±∂(Xn.Size*Scale)           S(Xn.Size*Scale)
  13850.  73     (*±∂,Xn.Size*Scale)          (S,Xn.Size*Scale)
  13851.  73     ([*±∂],Xm.Size*Scale,OD)     ([S],Xm.Size*Scale,OD)
  13852.  73     ([*±∂,Xn.Size*Scale],OD)     ([S,Xn.Size*Scale],OD)
  13853.  74     #data                        #data
  13854. ========================================================================
  13855.  
  13856. For A-traps, the substitution can be performed to substitute for the DC.W
  13857. opcode string.  If the substitution is made then the Disassembler will
  13858. generate ,Sys and/or ,Immed flags as operands for Toolbox traps and
  13859. ,AutoPop for OS traps when the bits in the trap word indicates these
  13860. settings.
  13861.  
  13862.         |         Generated          |            Substituted
  13863.         | Opcode  Operand  Comment   | Opcode  Operand        Comment
  13864. ========================================================================
  13865. Toolbox | DC.W    $AXXX    ; TB XXXX | S       [,Sys][,Immed] ; AXXX
  13866. OS      | DC.W    $AXXX    ; OS XXXX | S       [,AutoPop]     ; AXXX
  13867. ========================================================================
  13868.  
  13869. All displacements (∂, BD, OD) are hexadecimal values shown as a byte ($XX),
  13870. word ($XXXX), or long ($XXXXXXXX) as appropriate. The *Scale is suppressed if
  13871. 1. The Size is W or L.  Note that effective address substitutions can only be
  13872. made for "∂(An)", "BD,An", and "*±∂" cases.
  13873.     
  13874. For all the effective address modes 5, 6n, 7n, and for A-traps, a coroutine (a
  13875. procedure) whose address is specified by the LookupProc parameter is called by
  13876. the Disassembler (if LookupProc is not NIL) to do the substitution (or A-trap
  13877. comment) with a string returned by the proc.  It is assumed that the proc
  13878. pointed to by LookupProc is a level 1 Pascal proc declared as follows:
  13879.  
  13880. PROCEDURE Lookup(     PC:      UNIV Ptr;        {Addr of extension/trap word}
  13881.                      BaseReg: LookupRegs;       {Base register/lookup mode  }
  13882.                      Opnd:    UNIV LongInt;     {Trap word, PC addr, disp.  }
  13883.                  VAR S:       DisAsmStr80);     {Returned substitution      }
  13884.  
  13885. where TYPE DisAsmStr80 = String[80];
  13886.   
  13887. or in C,
  13888.  
  13889. pascal void LookUp(Ptr         PC, 
  13890.                    LookupRegs  BaseReg, 
  13891.                    long        Opnd, 
  13892.                    char        *S); 
  13893.  
  13894. PC      = Pointer to instruction extension word or A-trap word in the
  13895.           buffer pointed to by the Disassembler's FirstByte parameter.
  13896.           
  13897. BaseReg = This determines the meaning of the Opnd value and supplies
  13898.           the base register for the "∂(An)", "BD,An", and "*±∂" cases.
  13899.           BaseReg may contain any one of the following values:
  13900.          
  13901.           _A0_   =  0 ==> A0
  13902.           _A1_   =  1 ==> A1
  13903.           _A2_   =  2 ==> A2
  13904.           _A3_   =  3 ==> A3
  13905.           _A4_   =  4 ==> A4
  13906.           _A5_   =  5 ==> A5
  13907.           _A6_   =  6 ==> A6
  13908.           _A7_   =  7 ==> A7
  13909.           _PC_   =  8 ==> PC-relative (special case)
  13910.           _ABS_  =  9 ==> Abs addr    (special case)
  13911.           _TRAP_ = 10 ==> Trap word   (special case)
  13912.           
  13913.           For absolute addressing (modes 70 and 71),  BaseReg contains _ABS_.
  13914.           For A-traps, BaseReg would contain _TRAP_.
  13915.  
  13916. Opnd    = The contents of this LongInt is determined by the BaseReg parameter
  13917.           just described.
  13918.        
  13919.           For BaseReg = _TRAP_ (A-traps):
  13920.               Opnd is the entire trap word. The high order 16 bits of Opnd are
  13921.               zero.
  13922.  
  13923.           For BaseReg = _ABS_  (absolute effective address):
  13924.               Opnd contains the (extended) 32-bit address specifed by the
  13925.               instruction's effective address.  Such addresses would generally
  13926.               be used to reference low memory globals on a Macintosh.
  13927.  
  13928.           For BaseReg = _PC_  (PC-relative effective address):
  13929.               Opnd contains the 32-bit address represented by "*±∂" adjusted
  13930.               by the Disassembler's DstAdjust parameter.
  13931.               
  13932.           For BaseReg = _An_  (effective address with a base register):
  13933.               Opnd contains the (sign-extended) 32-bit (base) displacement
  13934.               from the instruction's effective address.
  13935.               
  13936.               In the Macintosh environment, a BaseReg specifying A5 implies
  13937.               either global data references or Jump Table references. Positive
  13938.               Opnd values with an A5 BaseReg thus mean Jump Table references,
  13939.               while a negative offset would mean a global data reference.
  13940.               Base registers of A6 or A7 would usually mean local data.
  13941.  
  13942. S       = Pascal string returned from Lookup containing the effective address
  13943.           substitution string or a trap name for A-traps.  S is set to null
  13944.           PRIOR to calling Lookup.  If it is still null on return, the string
  13945.           is not used.  If not null, then for A-traps, the returned string is
  13946.           used as a opcode string. In all other cases the string is
  13947.           substituted as shown in the above table.
  13948.            
  13949. Depending on the application, the caller has three choices on how to use the
  13950. Disassembler and an associated Lookup proc:
  13951.  
  13952. (1). The caller can call just the Disassembler and provide his own Lookup
  13953.      proc. In that case the calling conventions discussed above must be
  13954.      followed.
  13955.  
  13956. (2). The caller can provide NIL for the LookupProc parameter, in which case,
  13957.      NO Lookup proc will be called.
  13958.      
  13959. (3). The caller can call first InitLookup (described below, a proc provided
  13960.      with this unit) and pass the address of this unit's standard Lookup proc
  13961.      when Disassembler is called.  In this case all the control logic to
  13962.      determine the kind of substitution to be done is provided for the caller
  13963.      and all that need to be provided by the user are routines to look up any
  13964.      or all of the following:
  13965.      
  13966.      • PC-relative references
  13967.      • Jump Table references
  13968.      • Absolute address references
  13969.      • Trap names
  13970.      • References with offsets from base registers 
  13971. *)
  13972.  
  13973. æKY endOfModule
  13974. æFp DisAsmLookup.p
  13975. æT FUNCTION
  13976. æD FUNCTION endOfModule(address: UNIV Ptr;limit: UNIV Ptr;symbol: StringPtr;
  13977.     VAR nextModule: UNIV Ptr): StringPtr; C;
  13978. æDT myVariable := endOfModule(address,limit,symbol,nextModule);
  13979. æC 
  13980. { Check to see if the specified memory address contains a RTS, JMP (A0) or
  13981. RTD #n instruction immediately followed by a valid MacsBug symbol.  These
  13982. sequences are the only ones which can determine an end of module when MacsBug
  13983. symbols are present.  During the check, the instruction and its following
  13984. MacsBug symbol must be fully contained in the bytes starting at the specified
  13985. address parameter, up to, but not including, the byte pointed to by the limit
  13986. parameter.
  13987.  
  13988. If the end of module is NOT found, then NULL is returned as the function's
  13989. result.  However, if a end of module is found, the MacsBug symbol is returned
  13990. in symbol (if it is not NULL) as a null terminated Pascal string (with trailing
  13991. blanks removed), and the functions returns the pointer to the start of the
  13992. MacsBug symbol (i.e., address+2 for RTS or JMP (A0) and address+4 for RTD #n).
  13993. This address may then be used as in input parameter to showMacsBugSymbol to
  13994. convert the MacsBug symbol to a Disassembler operand string.
  13995.  
  13996. Also returned in nextModule is where we think the FOLLOWING module begins. In
  13997. the "old style" cases (see validMacsBugSymbol) this will always be 8 or 16
  13998. bytes after the input address.  For new style the Apple Pascal and C cases this
  13999. will depend on the symbol length, existence of a pad byte, and size of the
  14000. constant (literal) area.  See validMacsBugSymbol for a description of valid
  14001. MacsBug symbol formats. 
  14002.  }
  14003.  
  14004. æKY InitLookup
  14005. æFp DisAsmLookup.p
  14006. æT PROCEDURE
  14007. æD PROCEDURE InitLookup(PCRelProc: UNIV Ptr;JTOffProc: UNIV Ptr;TrapProc: UNIV Ptr;
  14008.     AbsAddrProc: UNIV Ptr;IdProc: UNIV Ptr);
  14009. æDT InitLookup(PCRelProc,JTOffProc,TrapProc,AbsAddrProc,IdProc);
  14010. æC 
  14011. { Prepare for use of this unit's Lookup proc.  When Disassembler is called
  14012. and the address of this unit's Lookup proc is specified, then for PC-relative,
  14013. Jump Table references, A-traps, absolute addresses, and offsets from a base
  14014. register, the associated level 1 Pascal proc specified here is called (if not
  14015. NULL -- all five addresses are preset to NULL). The calls assume the following
  14016. declarations for these procs (see Lookup, below for further details):
  14017.                              
  14018. PROCEDURE PCRelProc(Address: UNIV LongInt; 
  14019.                     VAR S:   UNIV DisAsmStr80);
  14020.  
  14021. PROCEDURE JTOffProc(A5JTOffset: UNIV Integer;
  14022.                     VAR S:      UNIV DisAsmStr80);
  14023.  
  14024. PROCEDURE TrapNameProc(TrapWord: UNIV Integer;
  14025.                        VAR S:     UNIV DisAsmStr80);
  14026.                         
  14027. PROCEDURE AbsAddrProc(AbsAddr: UNIV LongInt;
  14028.                       VAR S:   UNIV DisAsmStr80);
  14029.  
  14030. PROCEDURE IdProc(BaseReg: LookupRegs;
  14031.                  Offset:  UNIV LongInt;
  14032.                  VAR S:    UNIV DisAsmStr80);
  14033.  
  14034. or in C,
  14035.  
  14036. pascal void PCRelProc(long Address, char *S)
  14037.  
  14038. pascal void JTOffProc(short A5JTOffset, char *S)
  14039.  
  14040. pascal void TrapNameProc(unsigned short TrapWord, char *S)
  14041.  
  14042. pascal void AbsAddrProc(long AbsAddr, char *S)
  14043.  
  14044. pascal void IdProc(LookupRegs BaseReg, long Offset, char *S)
  14045.  
  14046. Note: InitLookup contains initialized data which requires initializing at load
  14047.       time (this is of concern only to users with assembler main programs.
  14048.  }
  14049.  
  14050. æKY Lookup
  14051. æFp DisAsmLookup.p
  14052. æT PROCEDURE
  14053. æD PROCEDURE Lookup(PC: UNIV Ptr;BaseReg: LookupRegs;Opnd: UNIV LongInt;
  14054.     VAR S: DisAsmStr80);
  14055. æDT Lookup(PC,BaseReg,Opnd,S);
  14056. æC 
  14057. { This is a standard Lookup proc available to the caller for calls to the
  14058. Disassembler.  If the caller elects to use this proc, then InitLookup MUST be
  14059. called prior to any calls to the Disassembler.  All the logic to determine the
  14060. type of lookup is done by this proc.  For PC-relative, Jump Table references,
  14061. A-traps, absolute addresses, and offsets from a base register, the associated
  14062. level 1 Pascal proc specified in the InitLookup call (if not NULL) is called.
  14063.  
  14064. This scheme simplifies the Lookup mechanism by allowing the caller to deal
  14065. with just the problems related to the application.
  14066.  }
  14067.  
  14068. æKY LookupRegs
  14069. _A0_
  14070. _A1_
  14071. _A2_
  14072. _A3_
  14073. _A4_
  14074. _A5_
  14075. _A6_
  14076. _A7_
  14077. _PC_
  14078. _ABS_
  14079. _TRAP_
  14080. æFp DisAsmLookup.p
  14081. æD LookupRegs = (_A0_,_A1_,_A2_,_A3_,_A4_,_A5_,_A6_,_A7_,_PC_,_ABS_,_TRAP_);
  14082.  
  14083. æKY LookupTrapName
  14084. æFp DisAsmLookup.p
  14085. æT PROCEDURE
  14086. æD PROCEDURE LookupTrapName(TrapWord: UNIV Integer;VAR S: UNIV DisAsmStr80);
  14087. æDT LookupTrapName(TrapWord,S);
  14088. æC 
  14089. { This is a procedure provided to allow conversion of a trap instruction (in
  14090.  TrapWord) to its corresponding trap name (in S).  It is provided primarily for
  14091.  use with the Disassembler and its address may be passed to InitLookup above for
  14092.  use by this unit's Lookup routine.  Alternatively, there is nothing prohibiting
  14093.  the caller from using it directly for other purposes or by some other lookup
  14094.  proc.
  14095.  
  14096. Note: The tables in this proc make the size of this proc about 9500 bytes.  The
  14097.      trap names are fully spelled out in upper and lower case.
  14098.  }
  14099.  
  14100. æKY ModifyOperand
  14101. æFp DisAsmLookup.p
  14102. æT PROCEDURE
  14103. æD PROCEDURE ModifyOperand(VAR Operand: UNIV DisAsmStr80);
  14104. æDT ModifyOperand(Operand);
  14105. æC 
  14106. { Scan an operand string, i.e., the null terminated Pascal string returned by
  14107. the Disassembler (null MUST be present here) and modify negative hex values to
  14108. negated positive value. For example, $FFFF(A5) would be modified to -$0001(A5).
  14109. The operand to be processed is  passed as the function's parameter which is
  14110. edited "in place" and returned to the caller.
  14111.  
  14112. This routine is essentially a pattern matcher and attempts to only modify 2, 4,
  14113. and 8 digit hex strings in the operand that "might" be offsets from a base
  14114. register.  If the matching tests are passed, the same number of original digits
  14115. are output (because that indicates a value's size -- byte, word, or long).
  14116.  
  14117. For a hex string to be modified, the following tests must be passed:
  14118.  
  14119. • There must have been exactly 2, 4, or 8 digits.
  14120.  
  14121.   Only hex strings $XX, $XXXX, and $XXXXXXXX are possible candidates because
  14122.   that is the only way the Disassembler generates offsets.
  14123.  
  14124. • Hex string must be delimited by a "(" or a ",".
  14125.  
  14126.   The "(" allows offsets for $XXXX(An,...) and $XX(An,Xn) addressing modes.
  14127.   The comma allows for the MC68020 addressing forms.
  14128.  
  14129. • The "$X..." must NOT be preceded by a "±".
  14130.  
  14131.   This eliminates the possibility of modifying the offset of a PC-relative
  14132.   addressing mode always generated in the form "*±$XXXX".
  14133.  
  14134. • The "$X..." must NOT be preceded by a "#".
  14135.  
  14136.   This eliminates modifying immediate data.
  14137.  
  14138. • Value must be negative.
  14139.  
  14140.   Negative values are the only values we modify.  A value $FFFF is modified to
  14141.   -$0001.
  14142.  }
  14143.  
  14144. æKY showMacsBugSymbol
  14145. æFp DisAsmLookup.p
  14146. æT FUNCTION
  14147. æD FUNCTION showMacsBugSymbol(symStart: UNIV Ptr;limit: UNIV Ptr;operand: StringPtr;
  14148.     VAR bytesUsed: INTEGER): StringPtr; C;
  14149. æDT myVariable := showMacsBugSymbol(symStart,limit,operand,bytesUsed);
  14150. æC 
  14151. { Format a MacsBug symbol as a operand of a DC.B directive.  The first one or two
  14152. bytes of the symbol are generated as $80+'c' if they have there high high bits
  14153. set.  All other characters are shown as characters in a string constant.  The
  14154. pad byte, if present, is one is also shown as $00.
  14155.  
  14156. This routine is called to check that the bytes pointed to by symStart represent
  14157. a valid MacsBug symbol.  The symbol must be fully contained in the bytes
  14158. starting at symStart, up to, but not including the byte pointed to by the limit
  14159. parameter.
  14160.  
  14161. When called, showMacsBugSymbol assumes that symStart is pointing at a valid
  14162. MacsBug symbol as validated by the validMacsBugSymbol or endOfModule routines.
  14163. As with validMacsBugSymbol, the symbol must be fully contained in the bytes
  14164. starting at symStart up to, but not including, the byte pointed to by the end
  14165. parameter.
  14166.  
  14167. The string is returned in the 'operand' parameter as a null terminated Pascal
  14168. string.  The function also returns a pointer to this string as its return
  14169. value (NULL is returned only if the byte pointed to by the limit parameter is
  14170. reached prior to processing the entire symbol -- which should not happen if
  14171. properly validated).  The number of bytes used for the symbol is returned in
  14172. bytesUsed.  Due to the way MacsBug symbols are encoded, bytesUsed may not
  14173. necessarily be the same as the length of the operand string.
  14174.  
  14175. A valid MacsBug symbol consists of the characters '_', '%', spaces, digits, and
  14176. upper/lower case letters in a format determined by the first two bytes of the
  14177. symbol as described in the validMacsBugSymbol routine.
  14178.  
  14179.  }
  14180.  
  14181. æKY validMacsBugSymbol
  14182. æFp DisAsmLookup.p
  14183. æT FUNCTION
  14184. æD FUNCTION validMacsBugSymbol(symStart: UNIV Ptr;limit: UNIV Ptr;symbol: StringPtr): StringPtr; C;
  14185. æDT myVariable := validMacsBugSymbol(symStart,limit,symbol);
  14186. æC 
  14187. { Check that the bytes pointed to by symStart represents a valid MacsBug symbol.
  14188. The symbol must be fully contained in the bytes starting at symStart, up to,
  14189. but not including, the byte pointed to by the limit parameter.
  14190.  
  14191. If a valid symbol is NOT found, then NULL is returned as the function's result.
  14192. However, if a valid symbol is found, it is copied to symbol (if it is not NULL)
  14193. as a null terminated Pascal string, and return a pointer to where we think the
  14194. FOLLOWING module begins. In the "old style" cases (see below) this will always
  14195. be 8 or 16 bytes after the input symStart.  For new style Apple Pascal and C
  14196. cases this will depend on the symbol length, existence of a pad byte, and size
  14197. of the constant (literal) area.  In all cases, trailing blanks are removed from
  14198. the symbol.
  14199.  
  14200. A valid MacsBug symbol consists of the characters '_', '%', spaces, digits, and
  14201. upper/lower case letters in a format determined by the first two bytes of the
  14202. symbol as follows:
  14203.  
  14204.  1st byte  | 2nd byte  |  Byte  |
  14205.    Range   |  Range    | Length | Comments
  14206. ==============================================================================
  14207.  $20 - $7F | $20 - $7F |    8   | "Old style" MacsBug symbol format
  14208.  $A0 - $FF | $20 - $7F |    8   | "Old style" MacsBug symbol format
  14209. ------------------------------------------------------------------------------
  14210.  $20 - $7F | $80 - $FF |   16   | "Old style" MacApp symbol ab==>b.a
  14211.  $A0 - $FF | $80 - $FF |   16   | "Old style" MacApp symbol ab==>b.a
  14212. ------------------------------------------------------------------------------
  14213.  $80       | $01 - $FF |    n   | n = 2nd byte       (Apple Compiler symbol)
  14214.  $81 - $9F | $00 - $FF |    m   | m = 1st byte & $7F (Apple Compiler symbol)
  14215. ==============================================================================
  14216.  
  14217. The formats are determined by whether bit 7 is set in the first and second
  14218. bytes.  This bit will removed when we find it or'ed into the first and/or
  14219. second valid symbol characters.
  14220.  
  14221. The first two formats in the above table are the basic "old style" (pre-
  14222. existing) MacsBug formats. The first byte may or may not have bit 7 set the
  14223. second byte is a valid symbol character.  The first byte (with bit 7 removed)
  14224. and the next 7 bytes are assumed to comprise the symbol.
  14225.  
  14226. The second pair of formats are also "old style" formats, but used for MacApp
  14227. symbols.  Bit 7 set in the second character indicates these formats. The symbol
  14228. is assumed to be 16 bytes with the second 8 bytes preceding the first 8 bytes
  14229. in the generated symbol.  For example, 12345678abcdefgh represents the symbol
  14230. abcdefgh.12345678.
  14231.  
  14232. The last pair of formats are reserved by Apple and generated by the MPW Pascal
  14233. and C compilers.  In these cases the value of the first byte is always between
  14234. $80 and $9F, or with bit 7 removed, between $00 and $1F.  For $00, the second
  14235. byte is the length of the symbol with that many bytes following the second
  14236. byte (thus a max length of 255). Values $01 to $1F represent the length itself.
  14237. A pad byte may follow these variable length cases if the symbol does not end
  14238. on a word boundary.  Following the symbol and the possible pad byte is a word
  14239. containing the size of the constants (literals) generated by the compiler.
  14240.  
  14241. Note that if symStart actually does point to a valid MacsBug symbol, then you
  14242. may use showMacsBugSymbol to convert the MacsBug symbol bytes to a string that
  14243. could be used as a DC.B operand for disassembly purposes.  This string
  14244. explicitly shows the MacsBug symbol encodings. }
  14245.  
  14246.  
  14247. æKY DiskInit.p
  14248. æKL DIBadMount
  14249. DIFormat
  14250. DILoad
  14251. DIUnload
  14252. DIVerify
  14253. DIZero
  14254.  
  14255. HFSDefaults
  14256.  
  14257. æKY HFSDefaults
  14258. æFp DiskInit.p
  14259. æT RECORD
  14260. æD HFSDefaults = RECORD
  14261.     sigWord: PACKED ARRAY [0..1] OF Byte; { signature word}
  14262.     abSize: LONGINT; { allocation block size in bytes}
  14263.     clpSize: LONGINT; { clump size in bytes}
  14264.     nxFreeFN: LONGINT; { next free file number}
  14265.     btClpSize: LONGINT; { B-Tree clump size in bytes}
  14266.     rsrv1: INTEGER; { reserved}
  14267.     rsrv2: INTEGER; { reserved}
  14268.     rsrv3: INTEGER; { reserved}
  14269.     END;
  14270. æC 
  14271. »Formatting Hierarchical Volumes
  14272.  
  14273. The Disk Initialization Package must set certain volume characteristics when placing
  14274. a hierarchical file directory on a volume. Default values for these volume characteristics
  14275. are stored in the 128K ROM; this section is for advanced programmers who want to
  14276. substitute their own values. The record containing the default values, if defined in
  14277. Pascal, would look like this:
  14278.  
  14279. TYPE  HFSDefaults = PACKED RECORD
  14280.                       sigWord:    ARRAY[1..2] OF CHAR;    {signature word}
  14281.                       abSize:     LONGINT;    {allocation block size in bytes}
  14282.                       clpSize:    LONGINT;    {clump size in bytes}
  14283.                       nxFreeFN:   LONGINT;    {next free file number}
  14284.                       btClpSize:  LONGINT;    {B*-Tree clump size in bytes}
  14285.                       rsrv1:      INTEGER;    {reserved}
  14286.                       rsrv2:      INTEGER;    {reserved}
  14287.                       rsrv3:      INTEGER;    {reserved}
  14288.                     END;
  14289.  
  14290. The default values for these fields are as follows:
  14291.  
  14292.   Field    Default value
  14293.  
  14294.   sigWord     'BD'
  14295.   abSize       0
  14296.   clpSize      4 * abSize
  14297.   nxFreeFN    16
  14298.   btClpSize    0
  14299.  
  14300. To supply your own values for these fields, create a similar, nonrelocatable record
  14301. containing the desired values and place a pointer to it in the global variable FmtDefaults.
  14302. To restore the system defaults, simply clear FmtDefaults.
  14303.  
  14304. The sigWord must equal 'BD' (meaning “big disk”) for the volume to be recognized as a
  14305. hierarchical volume. If the specified allocation block size is 0, the allocation
  14306. block size is calculated according to the size of the volume:
  14307.  
  14308.   abSize = (1 + (volSize in blocks / 64K)) * 512 bytes
  14309.  
  14310. If the specified B*-tree clump size is 0, the clump size for both the catalog and
  14311. extent trees is calculated according to the size of the volume:
  14312.  
  14313.   btClpSize = (volSize in blocks)/128 * 512bytes
  14314.  
  14315. æKY DILoad
  14316. æFp DiskInit.p
  14317. æT PROCEDURE
  14318. æD PROCEDURE DILoad;
  14319. æDT DILoad(paramList);
  14320. æMM
  14321. æRI II-396
  14322. æC 
  14323. Assembly-language note:  The trap macro for the Disk Initialization Package
  14324.                          is _Pack2. The routine selectors are as follows:
  14325.  
  14326.                            diBadMount  .EQU    0
  14327.                            diLoad      .EQU    2
  14328.                            diUnload    .EQU    4
  14329.                            diFormat    .EQU    6
  14330.                            diVerify    .EQU    8
  14331.                            diZero      .EQU    10
  14332.  
  14333. DILoad reads the Disk Initialization Package, and its associated dialog and dialog
  14334. items, from the system resource file into memory and makes them unpurgeable.
  14335.  
  14336. Note:  DIFormat, DIVerify, and DIZero don’t need the dialog, so if you use
  14337.        only these routines you can call the Resource Manager function
  14338.        GetResource to read just the package resource into memory (and
  14339.        the Memory Manager procedure HNoPurge to make it unpurgeable).
  14340.  
  14341. æKY DIUnload
  14342. æFp DiskInit.p
  14343. æT PROCEDURE
  14344. æD PROCEDURE DIUnload;
  14345. æDT DIUnload(paramList);
  14346. æMM
  14347. æRI II-396
  14348. æC  
  14349. Assembly-language note:  The trap macro for the Disk Initialization Package
  14350.                          is _Pack2. The routine selectors are as follows:
  14351.  
  14352.                            diBadMount  .EQU    0
  14353.                            diLoad      .EQU    2
  14354.                            diUnload    .EQU    4
  14355.                            diFormat    .EQU    6
  14356.                            diVerify    .EQU    8
  14357.                            diZero      .EQU    10
  14358.  
  14359. DIUnload makes the Disk Initialization Package (and its associated dialog and dialog
  14360. items) purgeable.
  14361.  
  14362. æKY DIBadMount
  14363. æFp DiskInit.p
  14364. æT FUNCTION
  14365. æD FUNCTION DIBadMount(where: Point;evtMessage: LONGINT): INTEGER;
  14366. æDT myVariable := DIBadMount(where,evtMessage);
  14367. æRI DIBadMount function  II-396, N70-1, P-34, 168
  14368.  
  14369. æC 
  14370. Assembly-language note:  The trap macro for the Disk Initialization Package
  14371.                          is _Pack2. The routine selectors are as follows:
  14372.  
  14373.                            diBadMount  .EQU    0
  14374.                            diLoad      .EQU    2
  14375.                            diUnload    .EQU    4
  14376.                            diFormat    .EQU    6
  14377.                            diVerify    .EQU    8
  14378.                            diZero      .EQU    10
  14379.  
  14380. Call DIBadMount when a disk-inserted event occurs if the result code in the high-order
  14381. word of the associated event message indicates an error (that is, the result code is
  14382. other than noErr). Given the event message in evtMessage, DIBadMount evaluates the
  14383. result code and either ejects the disk or lets the user initialize and name it. The
  14384. low-order word of the event message contains the drive number. The where parameter
  14385. specifies the location (in global coordinates) of the top left corner of the dialog
  14386. box displayed by DIBadMount.
  14387.  
  14388. If the result code passed is extFSErr, memFullErr, nsDrvErr, paramErr, or volOnLinErr,
  14389. DIBadMount simply ejects the disk from the drive and returns the result code. If the
  14390. result code ioErr, badMDBErr, or noMacDskErr is passed, the error can be corrected by
  14391. initializing the disk; DIBadMount displays a dialog box that describes the problem
  14392. and asks whether the user wants to initialize the disk. For the result code ioErr,
  14393. the dialog box shown in Figure 1 is displayed. (This happens if the disk is brand
  14394. new.) For badMDBErr and noMacDskErr, DIBadMount displays a similar dialog box in
  14395. which the description of the problem is “This disk is damaged” and “This is not a
  14396. Macintosh disk”, respectively.
  14397.  
  14398. •••Refer to Figure 1.•••
  14399.  
  14400. Figure 1–Disk Initialization Dialog for IOErr
  14401.  
  14402. Note:  Before presenting the disk initialization dialog, DIBadMount checks
  14403.        whether the drive contains an already mounted volume; if so, it ejects
  14404.        the disk and returns 2 as its result. This will happen rarely and may
  14405.        reflect an error in your program (for example, you forgot to call
  14406.        DILoad and the user had to switch to the disk containing the system
  14407.        resource file).
  14408.  
  14409. If the user responds to the disk initialization dialog by clicking the Eject button,
  14410. DIBadMount ejects the disk and returns 1 as its result. If the Initialize button is
  14411. clicked, a box displaying the message “Initializing
  14412. disk...” appears, and DIBadMount attempts to initialize the disk. If initialization
  14413. fails, the disk is ejected and the user is informed as shown in Figure 2; after the
  14414. user clicks OK, DIBadMount returns a negative result code ranging from firstDskErr to
  14415. lastDskErr, indicating that a low-level disk error occurred.
  14416.  
  14417. •••Refer to Figure 2.•••
  14418.  
  14419. Figure 2–Initialization Failure Dialog
  14420.  
  14421. If the disk is successfully initialized, the dialog box in Figure 3 appears. After
  14422. the user names the disk and clicks OK, DIBadMount mounts the volume by calling the
  14423. File Manager function MountVol and returns MountVol’s result code
  14424. (noErr if no error occurs).
  14425.  
  14426. •••Refer to Figure 3.•••
  14427.  
  14428. Figure 3–Dialog for Naming a Disk
  14429.  
  14430. Result codes    noErr               No error
  14431.                 extFSErr            External file system
  14432.                 memFullErr          Not enough room in heap zone
  14433.                 nsDrvErr            No such drive
  14434.                 paramErr            Bad drive number
  14435.                 volOnLinErr         Volume already on-line
  14436.                 firstDskErr         Low-level disk error
  14437.                 through lastDskErr
  14438.  
  14439. Other results   1                   User clicked Eject
  14440.                 2                   Mounted volume in drive
  14441.  
  14442. æKY DIFormat
  14443. æFp DiskInit.p
  14444. æT FUNCTION
  14445. æD FUNCTION DIFormat(drvNum: INTEGER): OSErr;
  14446. æDT myVariable := DIFormat(drvNum);
  14447. æMM
  14448. æRI II-398
  14449. æC 
  14450. Assembly-language note:  The trap macro for the Disk Initialization Package
  14451.                          is _Pack2. The routine selectors are as follows:
  14452.  
  14453.                            diBadMount  .EQU    0
  14454.                            diLoad      .EQU    2
  14455.                            diUnload    .EQU    4
  14456.                            diFormat    .EQU    6
  14457.                            diVerify    .EQU    8
  14458.                            diZero      .EQU    10
  14459.  
  14460. DIFormat formats the disk in the drive specified by the given drive number and returns
  14461. a result code indicating whether the formatting was completed successfully or failed.
  14462. Formatting a disk consists of writing special information onto it so that the Disk
  14463. Driver can read from and write to the disk.
  14464.  
  14465. Result codes    noErr               No error
  14466.                 firstDskErr         Low-level disk error
  14467.                 through lastDskErr
  14468.  
  14469. æKY DIVerify
  14470. æFp DiskInit.p
  14471. æT FUNCTION
  14472. æD FUNCTION DIVerify(drvNum: INTEGER): OSErr;
  14473. æDT myVariable := DIVerify(drvNum);
  14474. æMM
  14475. æRI II-398
  14476. æC 
  14477. Assembly-language note:  The trap macro for the Disk Initialization Package
  14478.                          is _Pack2. The routine selectors are as follows:
  14479.  
  14480.                            diBadMount  .EQU    0
  14481.                            diLoad      .EQU    2
  14482.                            diUnload    .EQU    4
  14483.                            diFormat    .EQU    6
  14484.                            diVerify    .EQU    8
  14485.                            diZero      .EQU    10
  14486.  
  14487. DIVerify verifies the format of the disk in the drive specified by the given drive
  14488. number; it reads each bit from the disk and returns a result code indicating whether
  14489. all bits were read successfully or not. DIVerify doesn’t affect the contents of the
  14490. disk itself.
  14491.  
  14492. Result codes    noErr               No error
  14493.                 firstDskErr         Low-level disk error
  14494.                 through lastDskErr
  14495.  
  14496. æKY DIZero
  14497. æFp DiskInit.p
  14498. æT FUNCTION
  14499. æD FUNCTION DIZero(drvNum: INTEGER;volName: Str255): OSErr;
  14500. æDT myVariable := DIZero(drvNum,volName);
  14501. æMM
  14502. æRT 70
  14503. æRI II-399, N70-2
  14504. æC 
  14505. Assembly-language note:  The trap macro for the Disk Initialization Package
  14506.                          is _Pack2. The routine selectors are as follows:
  14507.  
  14508.                            diBadMount  .EQU    0
  14509.                            diLoad      .EQU    2
  14510.                            diUnload    .EQU    4
  14511.                            diFormat    .EQU    6
  14512.                            diVerify    .EQU    8
  14513.                            diZero      .EQU    10
  14514.  
  14515. On the unmounted volume in the drive specified by the given drive number, DIZero
  14516. writes the volume information, a block map, and a file directory as for a volume with
  14517. no files; the volName parameter specifies the volume name to be included in the
  14518. volume information. This is the last step in initialization
  14519. (after formatting and verifying) and makes any files that are already on the volume
  14520. permanently inaccessible. If the operation fails, DIZero returns a result code indicating
  14521. that a low-level disk error occurred; otherwise, it mounts the volume by calling the
  14522. File Manager function MountVol and returns MountVol’s result code (noErr if no error
  14523. occurs).
  14524.  
  14525. Result codes    noErr              No error
  14526.                 badMDBErr          Bad master directory block
  14527.                 extFSErr           External file system
  14528.                 ioErr              I/O error
  14529.                 memFullErr         Not enough room in heap zone
  14530.                 noMacDskErr        Not a Macintosh disk
  14531.                 nsDrvErr           No such drive
  14532.                 paramErr           Bad drive number
  14533.                 volOnLinErr        Volume already on-line
  14534.                 firstDskErr        Low-level disk error
  14535.                 through lastDskErr
  14536.  
  14537.  
  14538. æKY Disks.p
  14539. æKL DiskEject
  14540. DriveStatus
  14541. SetTagBuffer
  14542.  
  14543. DriveKind
  14544. DrvSts
  14545. hard20
  14546. sony
  14547.  
  14548. æKY DriveKind
  14549. sony
  14550. hard20
  14551. æFp Disks.p
  14552. æT TYPE
  14553. æD DriveKind = (sony,hard20);
  14554. æC 
  14555.  
  14556. æKY DrvSts
  14557. æFp Disks.p
  14558. æT RECORD
  14559. æD DrvSts = RECORD
  14560.     track: INTEGER; {current track}
  14561.     writeProt: SignedByte; {bit 7 = 1 if volume is locked}
  14562.     diskInPlace: SignedByte; {disk in drive}
  14563.     installed: SignedByte; {drive installed}
  14564.     sides: SignedByte; {-1 for 2-sided, 0 for 1-sided}
  14565.     driveQLink: QElemPtr; {next queue entry}
  14566.     driveQVers: INTEGER; {1 for HD20}
  14567.     dQDrive: INTEGER; {drive number}
  14568.     dQRefNum: INTEGER; {driver reference number}
  14569.     dQFSID: INTEGER; {file system ID}
  14570.     CASE DriveKind OF
  14571.       sony:
  14572.         (twoSideFmt: SignedByte; {after 1st rd/wrt: 0=1 side, -1=2 side}
  14573.         needsFlush: SignedByte; {-1 for MacPlus drive}
  14574.         diskErrs: INTEGER); {soft error count}
  14575.       hard20:
  14576.         (driveSize: INTEGER; {drive block size low word}
  14577.         driveS1: INTEGER; {drive block size high word}
  14578.         driveType: INTEGER; {1 for HD20}
  14579.         driveManf: INTEGER; {1 for Apple Computer, Inc.}
  14580.         driveChar: SignedByte; {230 ($E6) for HD20}
  14581.         driveMisc: SignedByte); {0 -- reserved}
  14582.     END;
  14583. æC 
  14584.  
  14585. æKY DiskEject
  14586. æFp Disks.p
  14587. æT FUNCTION
  14588. æD FUNCTION DiskEject(drvNum: INTEGER): OSErr;
  14589. æDT myVariable := DiskEject(drvNum);
  14590. æMM
  14591. æRI II-214
  14592. æC 
  14593. [Not in ROM]
  14594.  
  14595. Assembly-language note:  DiskEject is equivalent to a Control call with
  14596.                          csCode equal to the global constant ejectCode.
  14597.  
  14598. DiskEject ejects the disk from the internal drive if drvNum is 1, or from the external
  14599. drive if drvNum is 2.
  14600.  
  14601. Result codes    noErr       No error
  14602.                 nsDrvErr    No such drive
  14603.  
  14604. æKY SetTagBuffer
  14605. æFp Disks.p
  14606. æT FUNCTION
  14607. æD FUNCTION SetTagBuffer(buffPtr: Ptr): OSErr;
  14608. æDT myVariable := SetTagBuffer(buffPtr);
  14609. æMM
  14610. æRI II-214
  14611. æC 
  14612. [Not in ROM]
  14613.  
  14614. Assembly-language note:  SetTagBuffer is equivalent to a Control call with
  14615.                          csCode equal to the global constant tgBuffCode.
  14616.  
  14617. An application can change the information used in the file tags buffer by calling
  14618. SetTagBuffer. The buffPtr parameter points to a buffer that contains the information
  14619. to be used. If buffPtr is NIL, the information in the file tags buffer isn’t changed.
  14620.  
  14621. If buffPtr isn’t NIL, every time the Disk Driver reads a sector from the disk, it
  14622. stores the file tags in the file tags buffer and in the buffer pointed to by buffPtr.
  14623. Every time the Disk Driver writes a sector onto the disk, it reads 12 bytes from the
  14624. buffer pointed to by buffPtr, places them in the file tags buffer, and then writes
  14625. them onto the disk.
  14626.  
  14627. The contents of the buffer pointed to by buffPtr are overwritten at the end of every
  14628. read request (which can be composed of a number of sectors) instead of at the end of
  14629. every sector. Each read request places 12 bytes in the buffer for each sector, always
  14630. beginning at the start of the buffer. This way an application can examine the file
  14631. tags for a number of sequentially read sectors. If a read request is composed of a
  14632. number of sectors, the Disk Driver places 12 bytes in the buffer for each sector. For
  14633. example, for a read request of five sectors, the Disk Driver will place 60 bytes in
  14634. the buffer.
  14635.  
  14636. Result codes    noErr    No error
  14637.  
  14638. æKY DriveStatus
  14639. æFp Disks.p
  14640. æT FUNCTION
  14641. æD FUNCTION DriveStatus(drvNum: INTEGER;VAR status: DrvSts): OSErr;
  14642. æDT myVariable := DriveStatus(drvNum,status);
  14643. æMM
  14644. æRI II-215
  14645. æC 
  14646. [Not in ROM]
  14647.  
  14648. Assembly-language note:  DriveStatus is equivalent to a Status call with
  14649.                          csCode equal to the global constant drvStsCode;
  14650.                          status is returned in csParam through csParam+21.
  14651.  
  14652. DriveStatus returns information about the internal drive if drvNum is 1, or about the
  14653. external drive if drvNum is 2. The information is returned in a record of type DrvSts:
  14654.  
  14655. TYPE  DrvSts = RECORD
  14656.                  track:        INTEGER;     {current track}
  14657.                  writeProt:    SignedByte;  {bit 7=1 if volume is locked}
  14658.                  diskInPlace:  SignedByte;  {disk in place}
  14659.                  installed:    SignedByte;  {drive installed}
  14660.                  sides:        SignedByte;  {bit 7=0 if single-side drive}
  14661.                  qLink:        QElemPtr;    {next queue entry}
  14662.                  qType:        INTEGER;     {reserved for future use}
  14663.                  dQDrive:      INTEGER;     {drive number}
  14664.                  dQRefNum:     INTEGER;     {driver reference number}
  14665.                  dQFSID:       INTEGER;     {file-system identifier}
  14666.                  twoSideFmt:   SignedByte;  {-1 if two-sided disk}
  14667.                  needsFlush:   SignedByte;  {reserved for future use}
  14668.                  diskErrs:     INTEGER      {error count}
  14669.                END;
  14670.  
  14671. The diskInPlace field is 0 if there’s no disk in the drive, 1 or 2 if there is a disk
  14672. in the drive, or –4 to –1 if the disk was ejected in the last 1.5 seconds. The installed
  14673. field is 1 if the drive is connected to the Macintosh, 0 if the drive might be connected
  14674. to the Macintosh, and –1 if the drive isn’t installed. The value of twoSideFmt is
  14675. valid only when diskInPlace=2. The value of diskErrs is incremented every time an
  14676. error occurs internally within the Disk Driver.
  14677.  
  14678. Result codes    noErr       No error
  14679.                 nsDrvErr    No such drive
  14680.  
  14681.  
  14682. æKY Editions.p
  14683. æKL AssociateSection
  14684. CallEditionOpenerProc
  14685. CallFormatIOProc
  14686. CloseEdition
  14687. CreateEditionContainerFile
  14688. DeleteEditionContainerFile
  14689. EditionHasFormat
  14690. FindEditionContainerDialog
  14691. GetEditionFormatMark
  14692. GetEditionInfo
  14693. GetEditionOpenerProc
  14694. GetLastEditionContainerUsed
  14695. GetStandardFormats
  14696. GotoPublisherSection
  14697. InitEditionPack
  14698. IsRegisterSection
  14699. NewPublisherDialog
  14700. NewPublisherExpDialog
  14701. NewSection
  14702. NewSubscriberDialog
  14703. NewSubscriberExpDialog
  14704. OpenEdition
  14705. OpenNewEdition
  14706. ReadEdition
  14707. RegisterSection
  14708. SectionOptionsDialog
  14709. SectionOptionsExpDialog
  14710. SetEditionFormatMark
  14711. SetEditionOpenerProc
  14712. UnRegisterSection
  14713. WriteEdition
  14714.  
  14715. EditionContainerSpec
  14716. EditionInfoRecord
  14717. EditionOpenerParamBlock
  14718. EditionOpenerVerb
  14719. eoCanSubscribe
  14720. eoClose
  14721. eoCloseNew
  14722. eoOpen
  14723. eoOpenNew
  14724. FormatIOParamBlock
  14725. FormatIOVerb
  14726. ioHasFormat
  14727. ioNewFormat
  14728. ioReadFormat
  14729. ioWriteFormat
  14730. kFormatLengthUnknown
  14731. kFormatListFormat
  14732. kPartNumberUnknown
  14733. kPartsNotUsed
  14734. kPreviewFormat
  14735. kPreviewHeight
  14736. kPreviewWidth
  14737. kPublisherDocAliasFormat
  14738. NewPublisherReply
  14739. NewSubscriberReply
  14740. pumOnSave
  14741. pumSuspend
  14742. rSectionType
  14743. sectionCancelMsgID
  14744. sectionEventMsgClass
  14745. SectionHandle
  14746. SectionOptionsReply
  14747. SectionPtr
  14748. sectionReadMsgID
  14749. SectionRecord
  14750. sectionScrollMsgID
  14751. sectionWriteMsgID
  14752. stPublisher
  14753. stSubscriber
  14754. sumAutomatic
  14755. sumOnRequestOnly
  14756.  
  14757. æKY rSectionType
  14758. æFp Editions.p
  14759. æT CONST
  14760. æD 
  14761. {  resource types  }
  14762.  
  14763. rSectionType = 'sect'; { ResType of saved SectionRecords }
  14764. æC 
  14765.  
  14766. æKY stSubscriber
  14767. æFp Editions.p
  14768. æT CONST
  14769. æD 
  14770. {  ssection types  }
  14771.  
  14772. stSubscriber = $01;
  14773. æC 
  14774.  
  14775. æKY stPublisher
  14776. æFp Editions.p
  14777. æT CONST
  14778. æD stPublisher = $0A;
  14779. æC 
  14780.  
  14781. æKY sumAutomatic
  14782. æFp Editions.p
  14783. æT CONST
  14784. æD 
  14785. {  update modes  }
  14786.  
  14787. sumAutomatic = 0; { subscriber update mode - Automatic        }
  14788. æC 
  14789.  
  14790. æKY sumOnRequestOnly
  14791. æFp Editions.p
  14792. æT CONST
  14793. æD sumOnRequestOnly = 1; { subscriber update mode - OnRequestOnly    }
  14794. æC 
  14795.  
  14796. æKY pumOnSave
  14797. æFp Editions.p
  14798. æT CONST
  14799. æD pumOnSave = 0; { publisher update mode - OnSave            }
  14800. æC 
  14801.  
  14802. æKY pumSuspend
  14803. æFp Editions.p
  14804. æT CONST
  14805. æD pumSuspend = 1; { publisher update mode - OnRequestOnly    }
  14806. æC 
  14807.  
  14808. æKY kPartsNotUsed
  14809. æFp Editions.p
  14810. æT CONST
  14811. æD kPartsNotUsed = 0;
  14812. æC 
  14813.  
  14814. æKY kPartNumberUnknown
  14815. æFp Editions.p
  14816. æT CONST
  14817. æD kPartNumberUnknown = (-1);
  14818. æC 
  14819.  
  14820. æKY kPreviewWidth
  14821. æFp Editions.p
  14822. æT CONST
  14823. æD kPreviewWidth = 120;
  14824. æC 
  14825.  
  14826. æKY kPreviewHeight
  14827. æFp Editions.p
  14828. æT CONST
  14829. æD kPreviewHeight = 120;
  14830. æC 
  14831.  
  14832. æKY kPublisherDocAliasFormat
  14833. æFp Editions.p
  14834. æT CONST
  14835. æD kPublisherDocAliasFormat = 'alis';
  14836. æC 
  14837.  
  14838. æKY kPreviewFormat
  14839. æFp Editions.p
  14840. æT CONST
  14841. æD kPreviewFormat = 'prvw';
  14842. æC 
  14843.  
  14844. æKY kFormatListFormat
  14845. æFp Editions.p
  14846. æT CONST
  14847. æD kFormatListFormat = 'fmts';
  14848. æC 
  14849.  
  14850. æKY kFormatLengthUnknown
  14851. æFp Editions.p
  14852. æT CONST
  14853. æD kFormatLengthUnknown = (-1);
  14854. æC 
  14855.  
  14856. æKY sectionEventMsgClass
  14857. æFp Editions.p
  14858. æT CONST
  14859. æD 
  14860. {  the following fields are private and set up by RegisterSection                    
  14861.  
  14862.     Section events now arrive in the message buffer using the new AppleEvent format.
  14863.     The direct object parameter is an aeTemporaryIDParamType ('tid '). The temporary
  14864.     ID's type is rSectionType ('sect') and the 32-bit value is a SectionHandle.
  14865.  
  14866.  }
  14867.  
  14868. sectionEventMsgClass = 'sect';
  14869. æC 
  14870.  
  14871. æKY sectionReadMsgID
  14872. æFp Editions.p
  14873. æT CONST
  14874. æD sectionReadMsgID = 'read';
  14875. æC 
  14876.  
  14877. æKY sectionWriteMsgID
  14878. æFp Editions.p
  14879. æT CONST
  14880. æD sectionWriteMsgID = 'writ';
  14881. æC 
  14882.  
  14883. æKY sectionScrollMsgID
  14884. æFp Editions.p
  14885. æT CONST
  14886. æD sectionScrollMsgID = 'scrl';
  14887. æC 
  14888.  
  14889. æKY sectionCancelMsgID
  14890. æFp Editions.p
  14891. æT CONST
  14892. æD sectionCancelMsgID = 'cncl';
  14893. æC 
  14894.  
  14895. æKY FormatIOVerb
  14896. ioHasFormat
  14897. ioReadFormat
  14898. ioNewFormat
  14899. ioWriteFormat
  14900. æFp Editions.p
  14901. æT TYPE
  14902. æD FormatIOVerb = (ioHasFormat,ioReadFormat,ioNewFormat,ioWriteFormat);
  14903. æC 
  14904.  
  14905. æKY EditionOpenerVerb
  14906. eoOpen
  14907. eoClose
  14908. eoOpenNew
  14909. eoCloseNew
  14910. eoCanSubscribe
  14911.  
  14912. æFp Editions.p
  14913. æT TYPE
  14914. æD EditionOpenerVerb = (eoOpen,eoClose,eoOpenNew,eoCloseNew,eoCanSubscribe);
  14915. æC 
  14916.  
  14917. æKY SectionRecord
  14918. SectionPtr
  14919. SectionHandle
  14920. æFp Editions.p
  14921. æT RECORD
  14922. æD SectionPtr = ^SectionRecord;
  14923. SectionHandle = ^SectionPtr;
  14924. SectionRecord = RECORD
  14925.     version: SignedByte; { always 0x01 in system 7.0 }
  14926.     kind: SectionType; { stSubscriber or stPublisher }
  14927.     mode: UpdateMode; { auto or manual }
  14928.     mdDate: TimeStamp; { last change in document }
  14929.     sectionID: long; { app. specific, unique per document }
  14930.     refCon: long; { application specific }
  14931.     alias: AliasHandle; { handle to Alias Record }
  14932.     subPart: long; { which part of container file }
  14933.     nextSection: SectionHandle; { for linked list of app's Sections }
  14934.     controlBlock: Handle; { used internally }
  14935.     refNum: EdtionRefNum; { used internally }
  14936.     END;
  14937. æC 
  14938.  
  14939. æKY EditionContainerSpec
  14940. æFp Editions.p
  14941. æT RECORD
  14942. æD EditionContainerSpec = RECORD
  14943.     theFile: CanonicalFileSpec;
  14944.     theFileScript: short;
  14945.     thePart: long;
  14946.     thePartName: Str31;
  14947.     thePartScript: short;
  14948.     END;
  14949. æC 
  14950.  
  14951. æKY EditionInfoRecord
  14952. æFp Editions.p
  14953. æT RECORD
  14954. æD EditionInfoRecord = RECORD
  14955.     crDate: TimeStamp; { date EditionContainer was created }
  14956.     mdDate: TimeStamp; { date of last change }
  14957.     fdCreator: OSType; { file creator }
  14958.     fdType: OSType; { file type }
  14959.     container: EditionContainerSpec; { the Edition }
  14960.     END;
  14961. æC 
  14962.  
  14963. æKY NewPublisherReply
  14964. æFp Editions.p
  14965. æT RECORD
  14966. æD NewPublisherReply = RECORD
  14967.     canceled: Boolean; { O }
  14968.     replacing : Boolean;
  14969.     usePart: Boolean; { I }
  14970.     preview: Handle; { I }
  14971.     previewFormat: FormatType; { I }
  14972.     container: EditionContainerSpec; { I/O }
  14973.     END;
  14974. æC 
  14975.  
  14976. æKY NewSubscriberReply
  14977. æFp Editions.p
  14978. æT RECORD
  14979. æD NewSubscriberReply = RECORD
  14980.     canceled: Boolean; { O }
  14981.     container: EditionContainerSpec; { I/O }
  14982.     END;
  14983. æC 
  14984.  
  14985. æKY SectionOptionsReply
  14986. æFp Editions.p
  14987. æT RECORD
  14988. æD SectionOptionsReply = RECORD
  14989.     canceled: Boolean; { O }
  14990.     changed: Boolean; { O }
  14991.     sectionH: SectionHandle; { I }
  14992.     action: ResType; { O }
  14993.     END;
  14994. æC 
  14995.  
  14996. æKY FormatIOParamBlock
  14997. æFp Editions.p
  14998. æT RECORD
  14999. æD FormatIOParamBlock = RECORD
  15000.     ioRefNum: long;
  15001.     format: FormatType;
  15002.     formatIndex: long;
  15003.     offset: unsigned longint;
  15004.     buffPtr: Ptr;
  15005.     buffLen: unsigned longint;
  15006.     END;
  15007. æC 
  15008.  
  15009. æKY EditionOpenerParamBlock
  15010. æFp Editions.p
  15011. æT RECORD
  15012. æD EditionOpenerParamBlock = RECORD
  15013.     info: EditionInfoRecord;
  15014.     sectionH: SectionHandle;
  15015.     document: CanonicalFileSpecPtr;
  15016.     fdCreator: OSType;
  15017.     ioRefNum: long;
  15018.     ioProc: FormatIOProcPtr;
  15019.     success: Boolean;
  15020.     END;
  15021. æC 
  15022.  
  15023. æKY InitEditionPack
  15024. æFp Editions.p
  15025. æT FUNCTION
  15026. æTN A82D
  15027. æD FUNCTION InitEditionPack: OSErr;
  15028.     INLINE $3F3C,$0010,$303C,$0100,$A82D;
  15029. æDT myVariable := InitEditionPack(paramList);
  15030. æC 
  15031. You use the InitEditionPack function to initialize the Edition Manager. Before
  15032. calling this funciton, be sure to determine if the Edition Manager is available
  15033. on your system using the Gestalt function.
  15034.  
  15035. FUNCTION InitEditionPack: OSErr;
  15036.  
  15037. The InitEditionPack function returns an error if the pack could not be loaded or
  15038. is an old version. If the InitEditionPack does not return noErr, there is not
  15039. enough system heap to load the package.
  15040.  
  15041. Result codes
  15042. noErr                   0  No error
  15043. editionMgrInitErr    -450  Could not load package
  15044. MemError                   NewHandle errors
  15045. ResError                   GetResource errors
  15046.  
  15047. æKY NewSection
  15048. æFp Editions.p
  15049. æT FUNCTION
  15050. æTN A82D
  15051. æD FUNCTION NewSection(container: EditionContinerSpecPtr;sectionDocument: CanonicalFileSpecPtr;
  15052.     kind: SectionType;sectionID: long;initalMode: UpdateMode;VAR sectionH: SectionHandle): OSErr;
  15053.     INLINE $303C,$0A02,$A82D;
  15054. æDT myVariable := NewSection(container,sectionDocument,kind,sectionID,initalMode,sectionH);
  15055. æC 
  15056. You use the NewSection routine to create a new section (either publisher or
  15057. subscriber), and alias record from the sectionDocument (document that contains a
  15058. section) to the edition container. The NewSection function allocates two
  15059. handles; one handle for the section record and another handle for the alias
  15060. record.
  15061.  
  15062. FUNCTION NewSection (container: EditionContainerSpec; sectionDocument:
  15063.                      CanonicalFileSpec; kind: SectionType; sectionID:
  15064.                      LongInt; initialMode: UpdateMode; VAR sectionH:
  15065.                      SectionHandle) : OSErr;
  15066.  
  15067. The container parameter is the name of the file which holds the edition.The
  15068. sectionDocument parameter is the file name (in canonical form) of the document
  15069. that contains section. The sectionDocument parameter can be NIL if your current
  15070. document has never been saved. If so, remember to call the AssociateSection
  15071. function when the user finally saves the document to update the alias record of
  15072. a registered section.
  15073.  
  15074. The kind parameter designates the type of section (publisher or subscriber)
  15075. being created. 
  15076.  
  15077. Identify the section with a unique number in the sectionID parameter.
  15078.  
  15079. The initialMode parameter contains the update mode for the section. For
  15080. publishers, this is either the constant pumOnSave or pumSuspend and for
  15081. subscribers this is either sumAutomatic or sumOnRequestOnly.
  15082.  
  15083. If the NewSection function fails, the sectionH parameter is set to NIL. If the
  15084. function is successful, sectionH contains the handle to the allocated section
  15085. record.
  15086.  
  15087. Result codes
  15088. noErr                    0  No error
  15089. editionMgrInitErr     -450  Manager not init’ed
  15090. badSubPartErr         -454  Bad container spec
  15091. badSectionErr         -451  Not valid SectionType
  15092. multiplePublisherWrn  -460  Already is a publisher
  15093. MemError                    NewHandle errors
  15094. ???                         NewAlias errors
  15095.  
  15096. The NewSection function internally calls the RegisterSection function to inform
  15097. the Edition Manager about a section.
  15098.  
  15099. æKY RegisterSection
  15100. æFp Editions.p
  15101. æT FUNCTION
  15102. æTN A82D
  15103. æD FUNCTION RegisterSection(sectionDocument: CanonicalFileSpec;sectionH: SectionHandle;
  15104.     VAR aliasWasChanged: Boolean): OSErr;
  15105.     INLINE $303C,$0604,$A82D;
  15106. æDT myVariable := RegisterSection(sectionDocument,sectionH,aliasWasChanged);
  15107. æC 
  15108. FUNCTION RegisterSection (sectionDocument: CanonicalFileSpec; sectionH:
  15109.                           SectionHandle; VAR aliasWasChanged: Boolean;) : OSErr;
  15110.  
  15111. The sectionDocument parameter is the file name of the document containing the
  15112. section. This parameter cannot be NIL.
  15113.  
  15114. The aliasWasChanged parameter returns TRUE if the alias for the edition
  15115. container subscribed to is out of date. If so, the RegisterSection function
  15116. updates the alias. This may occur if the file is moved to a new location or is
  15117. renamed.
  15118.  
  15119. The RegisterSection function adds the section record to the Edition Manager’s
  15120. list of registered sections, and allocates a control block. After calling the
  15121. RegisterSection function, the control block is either NIL or a valid control
  15122. block. The control block is NIL if the RegisterSection function cannot locate
  15123. the edition container being subscribed to. The RegisterSection function returns
  15124. containerNotFoundWrn. 
  15125.  
  15126. You can compare control blocks for individual sections. If two sections contain
  15127. the same control block value, these sections subscribe to the same edition. The
  15128. Edition Manager needs to be informed when no sections are referencing a control
  15129. block so that it can be deallocated. The control block maintains a count of how
  15130. many sections are referencing it. Each time you use the UnRegisterSection
  15131. function, the control block removes one from the number of sections. When the
  15132. number of sections reaches 0, the control block is deallocated.
  15133.  
  15134. For each section that you cannot register, you should display the document on
  15135. the user’s screen, scroll to the location of the section, and then call the
  15136. FindEditionContainerDialog function.
  15137.  
  15138. Result codes
  15139. noErr                    0  No error
  15140. editionMgrInitErr     -450  Manager not init’ed
  15141. badSectionErr         -451  Not valid SectionType
  15142. multiplePublisherWrn  -460  Already is a publisher
  15143. containerNotFoundWrn  -461  Alias was not resolved
  15144. ???                         MatchAlias errors
  15145.  
  15146.  
  15147. æKY UnRegisterSection
  15148. æFp Editions.p
  15149. æT FUNCTION
  15150. æTN A82D
  15151. æD FUNCTION UnRegisterSection(sectionH: SectionHandle): OSErr;
  15152.     INLINE $303C,$0206,$A82D;
  15153. æDT myVariable := UnRegisterSection(sectionH);
  15154. æC 
  15155. When a section needs to be disposed of because the document containing the
  15156. section is closing, or the user is canceling the section, you need to call the
  15157. UnRegisterSection function.
  15158.  
  15159. The sectionH parameter is a handle to the section record for a given section.
  15160.  
  15161. The UnRegisterSection function removes the section from the application’s list
  15162. of registered sections. You can then dispose of the section record and alias
  15163. record with standard memory and resource manager calls. Once unregistered, a
  15164. section does not received any events and cannot read or write any data.
  15165. Depending on your clipboard strategy, you may want to unregister sections that
  15166. have been cut into the clipboard.
  15167.  
  15168. Result codes
  15169. noErr                       0  No error
  15170. editionMgrInitErr        -450  Manager not init’ed
  15171. fBsyErr                        Section doing I/O
  15172. notRegisteredSectionErr  -452  Not registered
  15173.  
  15174. æKY IsRegisterSection
  15175. æFp Editions.p
  15176. æT FUNCTION
  15177. æTN A82D
  15178. æD FUNCTION IsRegisterSection(sectionH: SectionHandle): OSErr;
  15179.     INLINE $303C,$0208,$A82D;
  15180. æDT myVariable := IsRegisterSection(sectionH);
  15181. æC 
  15182. Each time your application receives a section event, your application must use
  15183. the IsRegisteredSection function to verify that the event received is for a
  15184. registered section.
  15185.  
  15186. FUNCTION IsRegisteredSection (sectionH: SectionHandle) : OSErr;
  15187.  
  15188. The sectionH parameter is a handle to the section record for a given section.
  15189. The IsRegisteredSection function does not return a Boolean—noErr indicates that
  15190. a section is registered.
  15191.  
  15192. Result codes
  15193. noErr                       0  No error
  15194. notRegisteredSectionErr  -452  Not registered
  15195.  
  15196. æKY FindEditionContainerDialog
  15197. æFp Editions.p
  15198. æT FUNCTION
  15199. æTN A82D
  15200. æD FUNCTION FindEditionContainerDialog(sectionDocument: CanonicalFileSpec;
  15201.     sectionH: SectionHandle;VAR aliasWasChanged: Boolean): OSErr;
  15202.     INLINE $303C,$060A,$A82D;
  15203. æDT myVariable := FindEditionContainerDialog(sectionDocument,sectionH,aliasWasChanged);
  15204. æC 
  15205. If an edition container cannot be found for a particular section during
  15206. registration, use the FindEditionContainerDialog to resolve the alias record of
  15207. the section.
  15208.  
  15209. FUNCTION FindEditionContainerDialog (sectionDocument: CanonicalFileSpec;       
  15210.  
  15211.                                      SectionH: SectionHandle; VAR 
  15212.                                      aliasWasChanged: Boolean) : OSErr;
  15213.  
  15214. The sectionDocument parameter is the file name of the document containing a
  15215. section in canonical form. This parameter cannot be NIL. If the
  15216. FindEditionContainerDialog function is successful, the sectionH parameter
  15217. contains the handle to the allocated section record.
  15218.  
  15219. The aliasWasChanged parameter returns TRUE if the alias for the edition
  15220. container that you are subscribing is out of date. This may occur if the file is
  15221. moved to a new location or is renamed.
  15222.  
  15223. The FindEditionContainerDialog functions assumes that your sections are
  15224. contained within the linked list of registered sections.If the
  15225. FindEditionContainerDialog function cannot locate the edition container, it will
  15226. display a dialog box on the user’s screen.
  15227.  
  15228. Result codes
  15229. noErr                    0  No error
  15230. editionMgrInitErr     -450  Manager not init’ed
  15231. containerNotFoundWrn  -461  Alias was not resolved
  15232. multiplePublisherWrn  -460  Already is a publisher
  15233. ???                         SelectAlias errors
  15234.  
  15235. æKY AssociateSection
  15236. æFp Editions.p
  15237. æT FUNCTION
  15238. æTN A82D
  15239. æD FUNCTION AssociateSection(sectionH: SectionHandle;newSectionDocument: CanonicalFileSpecPtr): OSErr;
  15240.     INLINE $303C,$040C,$A82D;
  15241. æDT myVariable := AssociateSection(sectionH,newSectionDocument);
  15242. æC 
  15243. If a user renames a document that contains sections or pastes a portion of a
  15244. document that contains a section into another document, use the AssociateSection
  15245. to update the alias record.
  15246.  
  15247. FUNCTION AssociateSection (sectionH: SectionHandle; newSectionDocument:        
  15248.  
  15249.                            CanonicalFileSpec) : OSErr;
  15250.  
  15251. The sectionH parameter is a handle to the section record for a given section.
  15252. The newSectionDocument contains the volume, folder and file name of the new
  15253. document. The AssociateSection function calls the update alias on the alias
  15254. record.
  15255.  
  15256. Result codes
  15257. noErr         0  No error
  15258. ???              UpdateAlias errors
  15259.  
  15260.  
  15261. æKY CreateEditionContainerFile
  15262. æFp Editions.p
  15263. æT FUNCTION
  15264. æTN A82D
  15265. æD FUNCTION CreateEditionContainerFile(editionFile: CanonicalFileSpec;fdCreator: OSType;
  15266.     editionFileNameScript: INTEGER): OSErr;
  15267.     INLINE $303C,$050E,$A82D;
  15268. æDT myVariable := CreateEditionContainerFile(editionFile,fdCreator,editionFileNameScript);
  15269. æC 
  15270. Each time a user creates a new publisher section within a document to an edition
  15271. that does not already exist, you use the CreateEditionContainerFile to create an
  15272. empty edition container.
  15273.  
  15274. FUNCTION CreateEditionContainerFile (containerFile: CanonicalFileSpec;
  15275.                                      fdCreator: OSType) : OSErr;
  15276.  
  15277. The containerFile parameter contains the volume, folder and file name for the
  15278. edition container being created. The fdCreator parameter contains the creator
  15279. type for the edition.
  15280.  
  15281. The CreateEditionContainerFile function creates an empty edition container file
  15282. (it does not contain any formats). This function creates a file with type
  15283. 'publ'. If your application has a bundle, you should designate an icon for it
  15284. now.
  15285.  
  15286. Result codes
  15287. noErr                   0  No error
  15288. editionMgrInitErr    -450  Manager not init’ed
  15289. ???                        PBHCreate errors
  15290. ???                        PBHOpen errors
  15291. ???                        PBWrite errors
  15292.  
  15293. æKY DeleteEditionContainerFile
  15294. æFp Editions.p
  15295. æT FUNCTION
  15296. æTN A82D
  15297. æD FUNCTION DeleteEditionContainerFile(editionFile: CanonicalFileSpec): OSErr;
  15298.     INLINE $303C,$0210,$A82D;
  15299. æDT myVariable := DeleteEditionContainerFile(editionFile);
  15300. æC 
  15301. If a user cancels a publisher section within a document or closes a document
  15302. containing a newly created publisher without saving, you need to remove the
  15303. edition container using the DeleteEditionContainerFile function.
  15304.  
  15305. FUNCTION DeleteEditionContainerFile (containerFile: CanonicalFileSpec) :       
  15306.  
  15307.                                      OSErr;
  15308.  
  15309. The containerFile parameter contains the volume, folder and file name for the
  15310. edition container being deleted.
  15311.  
  15312. You should use the DeleteEditionContainerFile function even if there are
  15313. subscribers to the edition. When a subscriber section tries to read in data, it
  15314. receives an error.
  15315.  
  15316. Result codes
  15317. noErr                   0  No error
  15318. editionMgrInitErr    -450  Manager not init’ed
  15319. ???                        PBHDelete errors
  15320.  
  15321. æKY OpenEdition
  15322. æFp Editions.p
  15323. æT FUNCTION
  15324. æTN A82D
  15325. æD FUNCTION OpenEdition(subscriberSectionH: SectionHandle;VAR refNum: Byte): OSErr;
  15326.     INLINE $303C,$0412,$A82D;
  15327. æDT myVariable := OpenEdition(subscriberSectionH,refNum);
  15328. æC
  15329. You initiate the reading of data from an edition (for a subscriber), use the
  15330. OpenEdition function.
  15331.  
  15332. FUNCTION OpenEdition (subscriberSectionH: SectionHandle; VAR refNum:
  15333.                       EditionRefNum) : OSErr;
  15334.  
  15335. The subscriberSectionH parameter is a handle to the section record for a given
  15336. section. The refnum parameter returns the reference number for the edition.
  15337.  
  15338. Multiple subscribers can simultaneously read data from a single edition.
  15339.  
  15340. Result codes
  15341. noErr                   0  No error
  15342. editionMgrInitErr    -450  Manager not init’ed
  15343. permErr                    Not a subscriber
  15344.  
  15345.  
  15346. æKY OpenNewEdition
  15347. æFp Editions.p
  15348. æT FUNCTION
  15349. æTN A82D
  15350. æD FUNCTION OpenNewEdition(publisherSectionH: SectionHandle;fdCreator: OSType;
  15351.     publisherSectionDocument: CanonicalFileSpecPtr;VAR refNum: EditionRefNum): OSErr;
  15352.     INLINE $303C,$0814,$A82D;
  15353. æDT myVariable := OpenNewEdition(publisherSectionH,fdCreator,publisherSectionDocument,refNum);
  15354. æC 
  15355. To initiate the writing of data from a publisher to its edition container, use
  15356. the OpenNewEdition function.
  15357.  
  15358. FUNCTION OpenNewEdition (publisherSectionH: SectionHandle; fdCreator:
  15359.                          OSType; sectionDocument: CanonicalFileSpec; VAR       
  15360.  
  15361.                          refNum: EditionRefNum) : OSErr;
  15362.  
  15363. The publisherSectionH parameter is the publisher section that you are writing to
  15364. the edition. The fdCreator parameter is the Finder creator type of the new
  15365. edition icon.
  15366.  
  15367. The sectionDocument parameter is the document which contains the publisher. This
  15368. parameter is used to create an alias from the edition to the document containing
  15369. the publisher. If you pass NIL for sectionDocument, an alias is not made and the
  15370. GotoPublisherSection function is unable to open the document containing the
  15371. publisher.
  15372.  
  15373. The refnum parameter returns the reference number for the edition. This
  15374. parameter is necessary for subsequent calls to WriteEdition,
  15375. SetEditionFormatMark, and CloseEdition to specify which publisher is writing its
  15376. data to an edition. If the edition cannot be opened for writing because there is
  15377. another publisher writing to it, or because the file system does not allow
  15378. writing, an error is returned and refNum is set to NIL.
  15379.  
  15380. Result codes
  15381. noErr                   0  No error
  15382. editionMgrInitErr    -450  Manager not init’ed
  15383. wrPermErr                  Not a publisher
  15384. notThePublisherWrn   -462  Not the publisher
  15385. ???                        NewHandle errors
  15386. ???                        PBHCreate errors
  15387. ???                        PBHOpen errors
  15388. ???                        NewAlias errors
  15389.  
  15390. æKY CloseEdition
  15391. æFp Editions.p
  15392. æT FUNCTION
  15393. æTN A82D
  15394. æD FUNCTION CloseEdition(whichEdition: EditionRefNum;success: BOOLEAN): OSErr;
  15395.     INLINE $303C,$0316,$A82D;
  15396. æDT myVariable := CloseEdition(whichEdition,success);
  15397. æC 
  15398. After finishing reading from or writing to an edition, use the CloseEdition
  15399. function to close the edition.
  15400.  
  15401. FUNCTION CloseEdition (refNum: EditionRefNum; success: Boolean) : OSErr;
  15402.  
  15403. The refnum parameter is the reference number for edition. Set the success
  15404. parameter is set to TRUE if the edition successfully closes. If not, set this
  15405. parameter to FALSE.
  15406.  
  15407. When you are finished reading data from an edition and you are using the
  15408. CloseEdition function, the EditionRefNum value becomes invalid. If the success
  15409. parameter is set to TRUE, the CloseEdition function takes the modification date
  15410. of the edition file that you have read in and puts it in the mdDate field of the
  15411. subscriber’s section record. This indicates that the data contained in the
  15412. edition and the subscriber section within the document are the same.
  15413.  
  15414. If you set the success parameter to FALSE because you are unable to read the
  15415. edition data (if there is not enough memory, or you didn’t find a format that
  15416. you can read), the CloseEdition function closes the edition, but does not set
  15417. the modification date field. This implies that the subscriber is not updated
  15418. with the latest edition.
  15419.  
  15420. When you have successfully finished writing data to an edition and you are using
  15421. the CloseEdition function, you should set the success parameter to TRUE. When
  15422. you do so, the data that you have written to the edition becomes available to
  15423. any subscribers. The Edition Manager sends a SectionReadEvent to all current
  15424. subscribers. The CloseEdition function sets the modification date (mdDate) of
  15425. the edition to correspond to the modification date of the publisher’s section
  15426. record. Each time a user edits a publisher within a document, you need to update
  15427. the modification date (even if the data is not yet written). 
  15428.  
  15429. If you set the success parameter to FALSE because you are unable to successfully
  15430. write data to the edition, the Edition Manager does not write any data to the
  15431. edition. The data contained in the edition prior to writing is restored.
  15432. SectionReadEvents are not sent to subscribers.
  15433.  
  15434. Result codes
  15435. noErr                   0  No error
  15436. editionMgrInitErr    -450  Manager not init’ed
  15437. rfNumErr                   Bad refNum
  15438. ???                        PBWrite errors
  15439. ???                        DisposHandle errors
  15440.  
  15441. æKY EditionHasFormat
  15442. æFp Editions.p
  15443. æT FUNCTION
  15444. æTN A82D
  15445. æD FUNCTION EditionHasFormat(whichEdition: EditionRefNum;whichFormat: FormatType;
  15446.     VAR length: Size): OSErr;
  15447.     INLINE $303C,$0618,$A82D;
  15448. æDT myVariable := EditionHasFormat(whichEdition,whichFormat,length);
  15449. æC
  15450. Use the EditionHasFormat function to find out in which formats the edition data
  15451. is available.
  15452.  
  15453. FUNCTION EditionHasFormat (whichEdition: EditionRefNum; whichFormat:
  15454.                            FormatType; VAR length: Size) : OSErr;
  15455.  
  15456. The whichEdition parameter is the reference number for the edition. The
  15457. whichFormat parameter indicates the format type that you are requesting. Apple
  15458. Computer recommends that you request formats in order of preference.
  15459.  
  15460. Upon return of the EditionHasFormat function, the length parameter contains the
  15461. length of the format for the edition you are specifying. If the requested format
  15462. is available, this function returns noErr and the length field returns the size
  15463. of the data in the specified format or kFormatLengthUnknown (-1) which signifies
  15464. that the size is unknown. You should continue to read the format until there is
  15465. no more data.
  15466.  
  15467. Be aware that the EditionHasFormat function may return kFormatLengthUnknown for
  15468. the length of the format.
  15469.  
  15470. Result codes
  15471. noErr                   0  No error
  15472. noTypeErr                  Format not available
  15473. editionMgrInitErr    -450  Manager not init’ed
  15474.  
  15475.  
  15476. æKY ReadEdition
  15477. æFp Editions.p
  15478. æT FUNCTION
  15479. æTN A82D
  15480. æD FUNCTION ReadEdition(whichEdition: EditionRefNum;whichFormat: FormatType;
  15481.     buffPtr: Ptr;VAR buffLen: Size): OSErr;
  15482.     INLINE $303C,$081A,$A82D;
  15483. æDT myVariable := ReadEdition(whichEdition,whichFormat,buffPtr,buffLen);
  15484. æC 
  15485. Use the ReadEdition function to read data from an edition.
  15486.  
  15487. FUNCTION ReadEdition (whichEdition: EditionRefNum; whichFormat:                
  15488.  
  15489.                       FormatType; buffPtr: Ptr; VAR buffLen: Size) :           
  15490.  
  15491.                       OSErr;
  15492.  
  15493. The whichEdition parameter is the reference number for the edition. The
  15494. whichFormat parameter indicates the format type that you want to read. 
  15495. The buffPtr parameter is a pointer to the buffer into which you are reading the
  15496. edition from. The buffLen parameter is the number of bytes that you want to read
  15497. into the buffer. The buffLen parameter is also a return value that returns the
  15498. total number of bytes read into the buffer. Once the buffLen field returns a
  15499. value less than the value you have specified, there is no additional data to
  15500. read, and the ReadEdition function returns noErr. If use the ReadEdition
  15501. function after all data is read in, the ReadEdition function returns an EoFErr.
  15502.  
  15503. Result codes
  15504. noErr                   0  No error
  15505. editionMgrInitErr    -450  Manager not init’ed
  15506. noTypeErr                  Format not available
  15507. rfNumErr                   Bad refNum
  15508. EofErr
  15509.  
  15510. æKY WriteEdition
  15511. æFp Editions.p
  15512. æT FUNCTION
  15513. æTN A82D
  15514. æD FUNCTION WriteEdition(whichEdition: EditionRefNum;whichFormat: FormatType;
  15515.     buffPtr: Ptr;buffLen: Size): OSErr;
  15516.     INLINE $303C,$081C,$A82D;
  15517. æDT myVariable := WriteEdition(whichEdition,whichFormat,buffPtr,buffLen);
  15518. æC 
  15519. Use the WriteEdition function to write data to an edition.
  15520.  
  15521. FUNCTION WriteEdition (refNum: EditionRefNum; whichFormat: FormatType;
  15522.                        buffPtr: Ptr; buffLen: Size) : OSErr;
  15523.  
  15524. The refnum parameter is the reference number for edition. The whichFormat
  15525. parameter indicates the format type that you want to write. 
  15526.  
  15527. The buffPtr parameter is a pointer to the buffer that you are writing into the
  15528. edition. The buffLen parameter is the number of bytes that you are writing. If
  15529. data cannot be entirely written to the edition, the WriteEdition function
  15530. returns a error.
  15531.  
  15532. Result codes
  15533. noErr                   0  No error
  15534. editionMgrInitErr    -450  Manager not init’ed
  15535. noTypeErr                  Unknown format
  15536. rfNumErr                   Bad refNum
  15537.  
  15538. æKY GetEditionFormatMark
  15539. æFp Editions.p
  15540. æT FUNCTION
  15541. æTN A82D
  15542. æD FUNCTION GetEditionFormatMark(whichEdition: EditionRefNum;whichFormat: FormatType;
  15543.     VAR currentMark: LONGINT): OSErr;
  15544.     INLINE $303C,$061E,$A82D;
  15545. æDT myVariable := GetEditionFormatMark(whichEdition,whichFormat,currentMark);
  15546. æC 
  15547. Use the GetEditionFormatMark to locate the current marker for a particular
  15548. format.
  15549.  
  15550. FUNCTION GetEditionFormatMark (whichEdition: EditionRefNum; whichFormat:
  15551.                                FormatType; VAR currentMark: LongInt) :         
  15552.  
  15553.                                OSErr;
  15554.  
  15555. The whichEdition parameter is the reference number for the edition. The
  15556. whichFormat parameter indicates the format type for the edition and the
  15557. currentMark parameter is the offset for the format. 
  15558.  
  15559. If you do not support the format that you are specifying, you receive noTypeErr.
  15560.  
  15561. Result codes
  15562. noErr         0  No error
  15563. noTypeErr        Unknown format
  15564. posErr           Mark not set anywhere
  15565.  
  15566. æKY SetEditionFormatMark
  15567. æFp Editions.p
  15568. æT FUNCTION
  15569. æTN A82D
  15570. æD FUNCTION SetEditionFormatMark(whichEdition: EditionRefNum;whichFormat: FormatType;
  15571.     setMarkTo: LONGINT): OSErr;
  15572.     INLINE $303C,$0620,$A82D;
  15573. æDT myVariable := SetEditionFormatMark(whichEdition,whichFormat,setMarkTo);
  15574. æC 
  15575. Use the SetEditionFormatMark to set the current mark for a section format.
  15576.  
  15577. FUNCTION SetEditionFormatMark (whichEdition: EditionRefNum; whichFormat:
  15578.                                FormatType; setMarkTo: LongInt) : OSErr;
  15579.  
  15580. The whichEdition parameter is the reference number for the edition. The
  15581. whichFormat parameter indicates the format type for the edition and the
  15582. setMarkTo parameter is the offset for the format.
  15583.  
  15584. When you are creating a publisher, and if the whichFormat does not exist for a
  15585. particular edition that you are writing data to, the SetEditionFormatMark
  15586. creates the format. You need to call the SetEditionFormatMark function before
  15587. writing data.
  15588.  
  15589. Result codes
  15590. noErr         0  No error
  15591. posErr           Manager not init’ed
  15592. ???              SetHandleSize errors
  15593.  
  15594. æKY GetEditionInfo
  15595. æFp Editions.p
  15596. æT FUNCTION
  15597. æTN A82D
  15598. æD FUNCTION GetEditionInfo(sectionH: SectionHandle;VAR editionInfo: EditionInfoRecord): OSErr;
  15599.     INLINE $303C,$0422,$A82D;
  15600. æDT myVariable := GetEditionInfo(sectionH,editionInfo);
  15601. æC
  15602. When the user wants to locate the publisher for a particular subscriber (by
  15603. choosing Find Publisher in the subscriber options dialog box), use the
  15604. GetEditionInfo function to find the edition container. You should then call the
  15605. GotoPublisherSection function.
  15606.  
  15607. The GetEditionInfo function returns information about a section’s edition such
  15608. as it’s location, last modification date, creator and type. This function only
  15609. works for registered sections which contain a non-NIL control block.
  15610.  
  15611. FUNCTION GetEditionInfo (sectionH: SectionHandle; VAR editionInfo:             
  15612.  
  15613.                          EditionInfoRecord) : OSErr;
  15614.  
  15615. The sectionH parameter is a handle to the section record for a given section.
  15616. The editionInfo parameter is a pointer from the EditionInfo record. The
  15617. GetEditionInfo function comprises the public information contained in the
  15618. control block.
  15619.  
  15620. The Edition Manager syncs to ensure that the existing edition name corresponds
  15621. to the Finder’s existing edition name. Refer to “Reading and Writing Edition
  15622. Data” for additional information. If an edition container could not be located
  15623. previously, the GetEditionInfo function tries to locate it again. If it cannot
  15624. be located a second time, the GetEditionInfo function returns a file not found
  15625. err.
  15626.  
  15627. TYPE EditionInfoRecord = 
  15628. RECORD
  15629.   crDate:     TimeStamp;
  15630.   mdDate:     TimeStamp;
  15631.   fdCreator:  OSType;
  15632.   fdType:     OSType;
  15633.   container:  EditionContainerSpec;
  15634. END;
  15635.  
  15636. The fdType field is the creator type 'publ'. The fdCreator field is specified in
  15637. the OpenNewEdition function. The container field is a volume, folder, and file
  15638. name for the edition.
  15639.  
  15640. The crDate field contains the creation date of the edition. The mdDate field
  15641. contains the modification date of the edition.
  15642.  
  15643. Result codes
  15644. noErr                   0  No error
  15645. editionMgrInitErr    -450  Manager not init’ed
  15646. fnfErr                     Not registered or file moved
  15647. ???                        PBHGetFInfo
  15648.  
  15649. Use the GetEditionFormatMark to locate the current marker for a particular
  15650. format.
  15651.  
  15652. FUNCTION GetEditionFormatMark (whichEdition: EditionRefNum; whichFormat:
  15653.                                FormatType; VAR currentMark: LongInt) :         
  15654.  
  15655.                                OSErr;
  15656.  
  15657. The whichEdition parameter is the reference number for the edition. The
  15658. whichFormat parameter indicates the format type for the edition and the
  15659. currentMark parameter is the offset for the format. 
  15660.  
  15661. If you do not support the format that you are specifying, you receive noTypeErr.
  15662.  
  15663. Result codes
  15664. noErr         0  No error
  15665. noTypeErr        Unknown format
  15666. posErr           Mark not set anywhere
  15667.  
  15668. æKY GotoPublisherSection
  15669. æFp Editions.p
  15670. æT FUNCTION
  15671. æTN A82D
  15672. æD FUNCTION GotoPublisherSection(VAR container: EditionContainerSpec): OSErr;
  15673.     INLINE $303C,$0224,$A82D;
  15674. æDT myVariable := GotoPublisherSection(container);
  15675. æC 
  15676. Use the GotoPublisherSection function to resolve the alias in the edition to
  15677. find the document containing its publisher. This function opens the document,
  15678. launches it’s application if necessary, and scrolls to the location of the
  15679. publisher. 
  15680.  
  15681. FUNCTION GotoPublisherSection (container: EditionContainerSpec) : OSErr;
  15682.  
  15683. The container parameter is the edition volume, folder, and file name. You obtain
  15684. the container by calling the GetEditionInfo function.
  15685.  
  15686. You should call the GotoPublisherSection function when the user selects Find
  15687. Publisher within the publisher options dialog box. The action code 'goto' is
  15688. returned to you.
  15689.  
  15690. Result codes
  15691. noErr                   0  No error
  15692. editionMgrInitErr    -450  Manager not init’ed
  15693. badSubPartErr        -454  Invalid container
  15694. MemError                   NewHandle errors
  15695. ???                        ResolveAlias errors
  15696.  
  15697. æKY GetLastEditionContainerUsed
  15698. æFp Editions.p
  15699. æT FUNCTION
  15700. æTN A82D
  15701. æD FUNCTION GetLastEditionContainerUsed(VAR container: EditionContainerSpec): OSErr;
  15702.     INLINE $303C,$0226,$A82D;
  15703. æDT myVariable := GetLastEditionContainerUsed(container);
  15704. æC 
  15705. Use the GetLastEditionContainerUsed function to display the last edition within
  15706. the dialog boxes. This function enables a user to easily subscribe to the data
  15707. recently published.
  15708.  
  15709. FUNCTION GetLastEditionContainerUsed (VAR container:                           
  15710.  
  15711.                                       EditionContainerSpec) : OSErr;
  15712.  
  15713. If the GetLastEditionContainer function locates the last edition for which a
  15714. section was created, the container parameter contains its volume, folder, file
  15715. name, part, and returns noErr. (The last edition created is associated with the
  15716. last time that you used the NewSection function.) If the last edition created to
  15717. is moved or deleted, the GetLastEditionContainer function cannot locate the last
  15718. edition. The container parameter returns the volume and folder for the edition,
  15719. leaves the file name blank, and returns fnfErr.
  15720.  
  15721. The Edition Manager syncs to ensure that its existing edition name corresponds
  15722. to the Finder’s existing edition name. Refer to “Reading and Writing Edition
  15723. Data” for additional information.
  15724.  
  15725. Pass the information from the GetLastEditionContainerUsed function to the
  15726. NewSubscriberDialog and the NewPublisherDialog functions.
  15727.  
  15728. Result codes
  15729. noErr                   0  No error
  15730. editionMgrInitErr    -450  Manager not init’ed
  15731. fnfErr                     Container not found
  15732.  
  15733. æKY GetStandardFormats
  15734. æFp Editions.p
  15735. æT FUNCTION
  15736. æTN A82D
  15737. æD FUNCTION GetStandardFormats(container: EditionContainerSpec;VAR previewFormat: FormatType;
  15738.     preview: Handle;publisherAliss: Handle;formats: Handle): OSErr;
  15739.     INLINE $303C,$0A28,$A82D;
  15740. æDT myVariable := GetStandardFormats(container,previewFormat,preview,publisherAliss,formats);
  15741. æC 
  15742. This function is called by the Edition Manager to get the alias used in the
  15743. GotoPublisherSection function and to get the preview shown in the new subscriber
  15744. dialog box. You will probably not need to call this function directly.
  15745.  
  15746. FUNCTION GetStandardFormats (container: EditionContainerSpec; VAR              
  15747.  
  15748.                              previewFormat: FormatType; preview: publisherAlias;
  15749.  
  15750.                              formats: Handle) : OSErr;
  15751.  
  15752. The container parameter is a pointer to the edition volume, folder, file name
  15753. and part.
  15754.  
  15755. You should pass in valid handes for the formats that you want and NIL for the
  15756. formats that you don’t want. The handles are resized to the size of the data.
  15757. The handle fmts reads the virtual format kFormatListFormat, the handle alis
  15758. reads the format kPublisherDocAliasFormat and the handle prvw tries to find the
  15759. following formats in this order: prvw, PICT and then TEXT. The first format
  15760. located returns in the preview handle and the previewFormat parameter is set to
  15761. its type. If none of the requested formats can be found, noTypeErr is returned.
  15762.  
  15763. Result codes
  15764. noErr                   0  No error
  15765. editionMgrInitErr    -450  Manager not init’ed
  15766. noTypeErr                  Container not found
  15767. MemError                   SetHandleSize errors
  15768. ???                        ResolveAlias errors
  15769.  
  15770. æKY GetEditionOpenerProc
  15771. æFp Editions.p
  15772. æT FUNCTION
  15773. æTN A82D
  15774. æD FUNCTION GetEditionOpenerProc(VAR opener: EditionOpenerProcPtr): OSErr;
  15775.     INLINE $303C,$022A,$A82D;
  15776. æDT myVariable := GetEditionOpenerProc(opener);
  15777. æC
  15778. Use the GetEditionOpenerProc to locate the current edition opener procedure.
  15779.  
  15780. FUNCTION GetEditionOpenerProc (VAR opener: EditionOpenerProcPtr) : OSErr;
  15781.  
  15782. The opener procedure returns the pointer to the current edition opener
  15783. procedure.
  15784.  
  15785.  
  15786. æKY SetEditionOpenerProc
  15787. æFp Editions.p
  15788. æT FUNCTION
  15789. æTN A82D
  15790. æD FUNCTION SetEditionOpenerProc(opener: EditionOpenerProcPtr): OSErr;
  15791.     INLINE $303C,$022C,$A82D;
  15792. æDT myVariable := SetEditionOpenerProc(opener);
  15793. æC 
  15794. Use the SetEditionOpenProc to provide your own edition opener procedure.
  15795.  
  15796. FUNCTION SetEditionOpenerProc (opener: EditionOpenerProcPtr) : OSErr;
  15797.  
  15798. The opener parameter is a pointer to the edition opener procedure that you are
  15799. providing.
  15800.  
  15801. æKY CallEditionOpenerProc
  15802. æFp Editions.p
  15803. æT FUNCTION
  15804. æTN A82D
  15805. æD FUNCTION CallEditionOpenerProc(selector: EditionOpenerVerb;VAR PB: EditionOpenerParamBlock;
  15806.     routine: EditionOpenerProcPtr): OSErr;
  15807.     INLINE $303C,$052E,$A82D;
  15808. æDT myVariable := CallEditionOpenerProc(selector,PB,routine);
  15809. æC 
  15810. The Edition Manager never opens or closes an edition container directly—it calls
  15811. the current “EditionOpener.” Use the CallEditionOpenerProc to call the edition
  15812. opener procedure pointer.
  15813.  
  15814. FUNCTION CallEditionOpenerProc (selector: EditionOpenerVerb; VAR params:       
  15815.  
  15816.                                 EditionOpenerParamBlock; routine:        
  15817.                                 EditionOpenerProcPtr) : OSErr;
  15818.  
  15819. Set the selector parameter to one of the edition opener verbs (eoOpen, eoClose,
  15820. eoOpenNew, eoCloseNew, eoCanSubscribe). The params parameter is an
  15821. EditionOpenerParamBlock record.
  15822.  
  15823. TYPE EditionOpenerParamBlock = 
  15824. RECORD
  15825.   info:      EditionInfoRecord;      {}
  15826.   sectionH:  SectionHandle;          {}
  15827.   document:  CanonicalFileSpecPtr;   {}
  15828.   misc:      LongInt;                {}
  15829.   ioRefNum:  LongInt;                {}
  15830.   ioProc:    FormatIOProcPtr;        {}
  15831. END;
  15832.  
  15833. The routine parameter is a pointer to an edition opener procedure.
  15834.  
  15835. æKY CallFormatIOProc
  15836. æFp Editions.p
  15837. æT FUNCTION
  15838. æTN A82D
  15839. æD FUNCTION CallFormatIOProc(selector: FormatIOVerb;VAR PB: FormatIOParamBlock;
  15840.     routine: FormatIOProcPtr): OSErr;
  15841.     INLINE $303C,$0530,$A82D;
  15842. æDT myVariable := CallFormatIOProc(selector,PB,routine);
  15843. æC The PB parameter of the CallFormatIOProc function is a FormatIOParamBlock
  15844. record.
  15845.  
  15846. TYPE FormatIOParamBlock = 
  15847. RECORD
  15848.   ioRefNum:     LongInt;     {}
  15849.   format:       FormatType;  {}
  15850.   formatIndex:  LongInt;     {}
  15851.   offset:       LongInt;     {}
  15852.   buffPtr:      Ptr;         {}
  15853.   buffLen:      LongInt;     {}
  15854. END;
  15855.  
  15856. The routine parameter is a pointer to a format I/O procedure.
  15857.  
  15858. You should have an IO function that contains the following parameters.
  15859.  
  15860. FUNCTION IO (selector: FormatIOVerb; VAR PB: FormatIOParamBlock) : OSErr;
  15861.  
  15862.  
  15863. æKY NewSubscriberDialog
  15864. æFp Editions.p
  15865. æT FUNCTION
  15866. æTN A82D
  15867. æD FUNCTION NewSubscriberDialog(VAR reply: NewSubscriberReply): OSErr;
  15868.     INLINE $303C,$0232,$A82D;
  15869. æDT myVariable := NewSubscriberDialog(reply);
  15870. æC
  15871. Use the NewSubscriberDialog function to display the new subscriber dialog box on
  15872. the user’s screen.
  15873.  
  15874. FUNCTION NewSubscriberDialog (VAR reply: NewSubscriberReply) : OSErr;
  15875.  
  15876. The reply parameter is the NewSubscriberReply record.
  15877.  
  15878. TYPE NewSubscriberReply = 
  15879. RECORD
  15880.   canceled:   Boolean;               {out}
  15881.   container:  EditionContainerSpec;  {in/out}
  15882. END;
  15883.  
  15884. Set the container parameter to be a pointer to a volume, folder, file name, and
  15885. part for the last edition subscribed to.
  15886.  
  15887. Upon return of the NewSubscriberDialog function, if the canceled parameter is
  15888. set to TRUE, the user canceled the dialog box. Otherwise, this parameter is
  15889. FALSE and the container parameter holds the container for the new subscriber.
  15890.  
  15891. Result codes
  15892. noErr                   0  No error
  15893. editionMgrInitErr    -450  Package not init’ed
  15894. badSubPartErr        -454  Bad container spec
  15895. MemError                   NewHandle errors
  15896. ResError                   GetResource errors
  15897.  
  15898.  
  15899. æKY NewSubscriberExpDialog
  15900. æFp Editions.p
  15901. æT FUNCTION
  15902. æTN A82D
  15903. æD FUNCTION NewSubscriberExpDialog(VAR reply: NewSubscriberReply;where: Point;
  15904.     expansionDITLresID: INTEGER;dlgHook: ExpDlgHookProcPtr;filterProc: ExpModalFilterProcPtr;
  15905.     yourDataPtr: Ptr): OSErr;
  15906.     INLINE $303C,$0B34,$A82D;
  15907. æDT myVariable := NewSubscriberExpDialog(reply,where,expansionDITLresID,dlgHook,filterProc,yourDataPtr);
  15908. æC 
  15909. Use the NewSubscriberExpDialog function to customize the new subscriber dialog
  15910. box.
  15911.  
  15912. FUNCTION NewSubscriberExpDialog (VAR reply: NewSubscriberReply; where:         
  15913.  
  15914.                                  Point; expansionDITLresID: Integer;           
  15915.  
  15916.                                  dlgHook: ExpDlgHookProcPtr; filterProc:       
  15917.  
  15918.                                  ExpModalFilterProcPtr; callBackPtr: Ptr)      
  15919.  
  15920.                                  : OSErr;
  15921.  
  15922. The NewSubscriberExpDialog, NewPublisherExpDialog, and SectionOptionsExpDialog
  15923. functions share the same parameters. Refer below for a detailed explanation of
  15924. the parameters.
  15925.  
  15926. Result codes
  15927. noErr                   0  No error
  15928. editionMgrInitErr    -450  Package not init’ed
  15929. MemError                   NewHandle errors
  15930. ResError                   GetResource errors
  15931.  
  15932. æKY NewPublisherDialog
  15933. æFp Editions.p
  15934. æT FUNCTION
  15935. æTN A82D
  15936. æD FUNCTION NewPublisherDialog(VAR reply: NewSubscriberReply): OSErr;
  15937.     INLINE $303C,$0236,$A82D;
  15938. æDT myVariable := NewPublisherDialog(reply);
  15939. æC
  15940. Use the NewPublisherDialog function to display the new publisher dialog box on
  15941. the user’s screen.
  15942.  
  15943. FUNCTION NewPublisherDialog (VAR reply: NewPublisherReply) : OSErr;
  15944.  
  15945. The reply parameter is a pointer from the NewPublisherReply record.
  15946.  
  15947. TYPE NewPublisherReply = 
  15948. RECORD
  15949.   canceled:       Boolean;              {out}
  15950.   replacing:      Boolean;              {out}
  15951.   usePart:        Boolean;              {in}
  15952.   preview:        Handle;               {in}
  15953.   previewFormat:  FormatType;           {in}
  15954.   container:      EditionContainerSpec  {in/out}
  15955. END;
  15956.  
  15957. The usePart parameter must be set to FALSE before calling the NewPublisherDialog
  15958. routine.
  15959.  
  15960. Set the container parameter to be a pointer to a volume, folder, and file name
  15961. for a default edition. Set the preview parameter to be a handle to the format
  15962. for the default edition and set the previewFormat parameter to indicate the
  15963. format of the default edition.
  15964.  
  15965. Upon return of the NewPublisherDialog function, the following three output
  15966. parameters can be set. If the canceled parameter is set to TRUE, the user
  15967. canceled the dialog box. If the replacing parameter is TRUE, the user chose an
  15968. existing file name from the list of available editions and confirmed this
  15969. replacement. If the replacing parameter is TRUE, do not call the
  15970. CreateEditionContainerFile function which creates a new edition container. The
  15971. container parameter contains the volume, folder and file name for the default
  15972. edition. 
  15973. Deallocate the preview parameter to free up memory.
  15974.  
  15975. Result codes
  15976. noErr                   0  No error
  15977. editionMgrInitErr    -450  Package not init’ed
  15978. badSubPartErr        -454  Bad container spec
  15979. MemError                   NewHandle errors
  15980. ResError                   GetResource errors
  15981.  
  15982.  
  15983. æKY NewPublisherExpDialog
  15984. æFp Editions.p
  15985. æT FUNCTION
  15986. æTN A82D
  15987. æD FUNCTION NewPublisherExpDialog(VAR reply: NewSubscriberReply;where: Point;
  15988.     expansionDITLresID: INTEGER;dlgHook: ExpDlgHookProcPtr;filterProc: ExpModalFilterProcPtr;
  15989.     yourDataPtr: UNIV Ptr): OSErr;
  15990.     INLINE $303C,$0B38,$A82D;
  15991. æDT myVariable := NewPublisherExpDialog(reply,where,expansionDITLresID,dlgHook,filterProc,yourDataPtr);
  15992. æC 
  15993. Use the NewPublisherExpDialog function to customize the new publisher dialog
  15994. box.
  15995.  
  15996. FUNCTION NewPublisherExpDialog (VAR reply: NewPublisherReply; where:           
  15997.  
  15998.                                 Point; expansionDITLresID: Integer;            
  15999.  
  16000.                                 dlgHook: ExpDlgHookProcPtr; filterProc:        
  16001.  
  16002.                                 ExpModalFilterProcPtr; callBackPtr: Ptr)       
  16003.  
  16004.                                 : OSErr;
  16005.  
  16006. The NewSubscriberExpDialog, NewPublisherExpDialog, and SectionOptionsExpDialog
  16007. functions share the same parameters. Refer below for a detailed explanation of
  16008. the parameters.
  16009.  
  16010. Result codes
  16011. noErr                   0  No error
  16012. editionMgrInitErr    -450  Package not init’ed
  16013. MemError                   NewHandle errors
  16014. ResError                   GetResource errors
  16015.  
  16016. æKY SectionOptionsDialog
  16017. æFp Editions.p
  16018. æT FUNCTION
  16019. æTN A82D
  16020. æD FUNCTION SectionOptionsDialog(VAR reply: SectionOptionsReply): OSErr;
  16021.     INLINE $303C,$023A,$A82D;
  16022. æDT myVariable := SectionOptionsDialog(reply);
  16023. æC
  16024. Use the SectionOptionsDialog function to display the publisher options and
  16025. subscriber options dialog boxes on the user’s screen.
  16026.  
  16027. FUNCTION SectionOptionsDialog  (VAR reply: SectionOptionsReply) : OSErr;
  16028.  
  16029. The reply parameter is a pointer from the SectionOptionsReply record.
  16030.  
  16031. TYPE SectionOptionsReply = 
  16032. RECORD
  16033.   canceled:  Boolean;       {out}
  16034.   changed:   Boolean;       {out}
  16035.   sectionH:  SectionHandle; {in}
  16036.   action:    ResType;       {out}
  16037. END;
  16038.  
  16039. The sectionH parameter is a handle to the section record for a given section.
  16040.  
  16041. Upon return of the SectionOptionsDialog function, the following output
  16042. parameters can be set. If the canceled parameter is set to TRUE, the user
  16043. canceled the dialog box. Otherwise, this parameter is FALSE. If the changed
  16044. parameter is TRUE (if for example, the update mode is changed), the user changed
  16045. the section record.
  16046.  
  16047. The action parameter contains the code for 1 of 4 user actions. 
  16048.  
  16049.   •   action code is 'read' for user selection of Get Edition Now
  16050.   •   action code is 'writ' for user selection of Publish Now
  16051.   •   action code is 'goto' for user selection of Find Publisher
  16052.   •   action code is 'cncl' for user selection of Cancel Publisher or Cancel 
  16053.       Subscriber
  16054.  
  16055. Your application can expand dialog boxes to include DITL items, apply alternate
  16056. mapping of events to item hits, and apply alternate meanings to the item hits.
  16057.  
  16058.  
  16059. æKY SectionOptionsExpDialog
  16060. æFp Editions.p
  16061. æT FUNCTION
  16062. æTN A82D
  16063. æD FUNCTION SectionOptionsExpDialog(VAR reply: SectionOptionsReply;where: Point;
  16064.     expansionDITLresID: INTEGER;dlgHook: ExpDlgHookProcPtr;filterProc: ExpModalFilterProcPtr;
  16065.     yourDataPtr: UNIV Ptr): OSErr;
  16066.     INLINE $303C,$0B3C,$A82D;
  16067. æDT myVariable := SectionOptionsExpDialog(reply,where,expansionDITLresID,dlgHook,filterProc,yourDataPtr);
  16068. æC 
  16069. Use the SectionOptionsExpDialog function to customize the publisher and
  16070. subscriber dialog boxes.
  16071.  
  16072. FUNCTION SectionOptionsExpDialog  (VAR reply: SectionOptionsReply; where:      
  16073.  
  16074.                                    Point; expansionDITLresID: Integer;         
  16075.  
  16076.                                    dlgHook: ExpDlgHookProcPtr;                 
  16077.  
  16078.                                    filterProc: ExpModalFilterProcPtr;          
  16079.  
  16080.                                    callBackPtr: Ptr) : OSErr;
  16081.  
  16082.  
  16083. æKY EPPC.p
  16084. æKL AcceptHighLevelEvent
  16085. GetPortNameFromProcessSerialNumber
  16086. GetProcessSerialNumberFromPortName
  16087. GetSpecificHighLevelEvent
  16088. PostHighLevelEvent
  16089.  
  16090. bufferIsSmall
  16091. connectionInValid
  16092. HighLevelEventMsg
  16093. HighLevelEventMsgClass
  16094. HighLevelEventMsgHdl
  16095. HighLevelEventMsgPtr
  16096. kHighLevelEvent
  16097. msgWasFullyAccepted
  16098. msgWasNotAccepted
  16099. msgWasPartiallyAccepted
  16100. nAttnMsg
  16101. noOutstandingHLE
  16102. nReturnReceipt
  16103. priorityMask
  16104. receiverIDisPSN
  16105. receiverIDisSessionID
  16106. receiverIDisSignature
  16107. receiverIDisTargetID
  16108. receiverIDMask
  16109. registerOnNetwork
  16110. rtrnReciptMsgID
  16111. systemOptionsMask
  16112. TargetID
  16113. TargetIDPtr
  16114.  
  16115. æKY kHighLevelEvent
  16116. æFp EPPC.p
  16117. æT CONST
  16118. æD kHighLevelEvent = 23;
  16119. æC 
  16120.  
  16121. æKY receiverIDMask
  16122. æFp EPPC.p
  16123. æT CONST
  16124. æD 
  16125. {  postOptions currently supported }
  16126.  
  16127. receiverIDMask = $0000F000;
  16128. æC 
  16129.  
  16130. æKY receiverIDisPSN
  16131. æFp EPPC.p
  16132. æT CONST
  16133. æD receiverIDisPSN = $00008000;
  16134. æC 
  16135.  
  16136. æKY receiverIDisSignature
  16137. æFp EPPC.p
  16138. æT CONST
  16139. æD receiverIDisSignature = $00007000;
  16140. æC 
  16141.  
  16142. æKY receiverIDisSessionID
  16143. æFp EPPC.p
  16144. æT CONST
  16145. æD receiverIDisSessionID = $00006000;
  16146. æC 
  16147.  
  16148. æKY receiverIDisTargetID
  16149. æFp EPPC.p
  16150. æT CONST
  16151. æD receiverIDisTargetID = $00005000;
  16152. æC 
  16153.  
  16154. æKY systemOptionsMask
  16155. æFp EPPC.p
  16156. æT CONST
  16157. æD systemOptionsMask = $00000F00;
  16158. æC 
  16159.  
  16160. æKY nReturnReceipt
  16161. æFp EPPC.p
  16162. æT CONST
  16163. æD nReturnReceipt = $00000200;
  16164. æC 
  16165.  
  16166. æKY priorityMask
  16167. æFp EPPC.p
  16168. æT CONST
  16169. æD priorityMask = $000000FF;
  16170. æC 
  16171.  
  16172. æKY nAttnMsg
  16173. æFp EPPC.p
  16174. æT CONST
  16175. æD nAttnMsg = $00000001;
  16176. æC 
  16177.  
  16178. æKY registerOnNetwork
  16179. æFp EPPC.p
  16180. æT CONST
  16181. æD registerOnNetwork = $80000000;
  16182. æC 
  16183.  
  16184. æKY bufferIsSmall
  16185. æFp EPPC.p
  16186. æT CONST
  16187. æD 
  16188. {  error returns from Post and Accept */
  16189.  }
  16190.  
  16191. bufferIsSmall = -607;
  16192. æC 
  16193.  
  16194. æKY noOutstandingHLE
  16195. æFp EPPC.p
  16196. æT CONST
  16197. æD noOutstandingHLE = -608;
  16198. æC 
  16199.  
  16200. æKY connectionInValid
  16201. æFp EPPC.p
  16202. æT CONST
  16203. æD connectionInValid = -609;
  16204. æC 
  16205.  
  16206. æKY HighLevelEventMsgClass
  16207. æFp EPPC.p
  16208. æT CONST
  16209. æD 
  16210. {  constant for return receipts */
  16211.  }
  16212.  
  16213. HighLevelEventMsgClass = 'jaym';
  16214. æC 
  16215.  
  16216. æKY rtrnReciptMsgID
  16217. æFp EPPC.p
  16218. æT CONST
  16219. æD rtrnReciptMsgID = 'rtrn';
  16220. æC 
  16221.  
  16222. æKY msgWasPartiallyAccepted
  16223. æFp EPPC.p
  16224. æT CONST
  16225. æD msgWasPartiallyAccepted = 2;
  16226. æC 
  16227.  
  16228. æKY msgWasFullyAccepted
  16229. æFp EPPC.p
  16230. æT CONST
  16231. æD msgWasFullyAccepted = 1;
  16232. æC 
  16233.  
  16234. æKY msgWasNotAccepted
  16235. æFp EPPC.p
  16236. æT CONST
  16237. æD msgWasNotAccepted = 0;
  16238. æC 
  16239.  
  16240. æKY TargetID
  16241. TargetIDPtr
  16242. æFp EPPC.p
  16243. æT RECORD
  16244. æD TargetIDPtr = ^TargetID;
  16245. TargetID = RECORD
  16246.     sessionID: long;
  16247.     name: PortName;
  16248.     location: LocName;
  16249.     recvrName: PortName;
  16250.     END;
  16251. æC 
  16252.  
  16253. æKY HighLevelEventMsg
  16254. HighLevelEventMsgPtr
  16255. HighLevelEventMsgHdl
  16256. æFp EPPC.p
  16257. æT RECORD
  16258. æD HighLevelEventMsgPtr = ^HighLevelEventMsg;
  16259. HighLevelEventMsgHdl = ^HighLevelEventMsgPtr;
  16260. HighLevelEventMsg = RECORD
  16261.     sessionID: long;
  16262.     HighLevelEventMsgHeaderLength: unsigned word;
  16263.     version: unsigned word;
  16264.     reserved1: unsigned longint;
  16265.     theMsgEvent: EventRecord;
  16266.     userRefcon: unsigned longint;
  16267.     postingOptions: unsigned longint;
  16268.     msgLength: unsigned longint;
  16269.     END;
  16270. æC 
  16271.  
  16272. æKY PostHighLevelEvent
  16273. æFp EPPC.p
  16274. æT FUNCTION
  16275. æTN A88F
  16276. æD FUNCTION PostHighLevelEvent(theEvent: EventRecord;receiverID: Ptr;msgRefcon: unsigned longint;
  16277.     msgBuff: Ptr;msgLen: unsigned longint;postingOptions: unsigned longint): OSErr;
  16278.     INLINE $3F3C,$0034,$A88F;
  16279. æDT myVariable := PostHighLevelEvent(theEvent,receiverID,msgRefcon,msgBuff,msgLen,postingOptions);
  16280. æC 
  16281. You can use the PostHighLevelEvent routine to send a high-level event to another
  16282. application.
  16283.  
  16284. FUNCTION PostHighLevelEvent (theEvent: EventRecord; receiverID: Ptr {UNIV
  16285.                 LongInt}; msgRefcon: LongInt; msgBuff: Ptr;
  16286.                 msgLen: LongInt; postingOptions: LongInt) : OSErr;
  16287.  
  16288. You specify the event to send in parameter theEvent, and include any additional
  16289. data for the event by providing a pointer to a data buffer in the msgBuff
  16290. parameter. The msgLen parameter specifies the size of the data buffer. The
  16291. receiverID parameter specifies the recipient of the event. The msgRefcon
  16292. parameter specifies a unique number associated with this event. Your application
  16293. can set this field to any value it chooses.
  16294.  
  16295. You can specify the receiver of the event by session ID, process serial number,
  16296. signature, or port name and port location. You can use any of these
  16297. specifications to send an event to another application on the local machine. You
  16298. can use only the session ID or port name and port location to send an event to
  16299. an application on a remote machine.
  16300.  
  16301. You use the postingOptions parameter to specify delivery options and options
  16302. associated with the receiverID parameter. You can specify one or more delivery
  16303. options to indicate whether you want the other application to receive the event
  16304. at the next opportunity, and to indicate whether you want acknowledgment that
  16305. the event was received by the other application. You use the options associated
  16306. with the receiverID parameter to indicate how you are specifying the recipient
  16307. of the event.
  16308.  
  16309. Result codes
  16310. noErr                 0  Mo error
  16311. connectionInValid  –609  Connection is invalid
  16312.  
  16313. æKY AcceptHighLevelEvent
  16314. æFp EPPC.p
  16315. æT FUNCTION
  16316. æTN A88F
  16317. æD FUNCTION AcceptHighLevelEvent(VAR sender: TargetID;VAR msgRefcon: LONGINT;
  16318.     msgBuff: Ptr;VAR msgLen: LONGINT): OSErr;
  16319.     INLINE $3F3C,$0033,$A88F;
  16320. æDT myVariable := AcceptHighLevelEvent(sender,msgRefcon,msgBuff,msgLen);
  16321. æC 
  16322. Some high-level events may be fully specified by their event record only, while
  16323. others may include additional information in an optional buffer. To get any
  16324. additional information and to find the sender of the event, use the
  16325. AcceptHighLevelEvent function.
  16326.  
  16327. FUNCTION AcceptHighLevelEvent (VAR sender: TargetID; VAR msgRefcon: LongInt; 
  16328.                                msgBuff: Ptr; VAR msgLen: LongInt) : OSErr;
  16329.  
  16330. The sender of the event is specified in the sender parameter, which is a pointer
  16331. to a TargetID data structure. The sender parameter contains the session
  16332. reference number that identifes this communication and the port name and port
  16333. location of the sender.
  16334.  
  16335. The msgRefcon parameter is a unique number that is used to identify this event.
  16336. If you send a response to this event, you should specify the same value of
  16337. msgRefcon so that the sender of the event can associate the reply with the
  16338. original request.
  16339.  
  16340. The msgBuff parameter points to any additional data associated with the event.
  16341. The msgLen parameter contains the size of the buffer. Your application is
  16342. responsible for allocating the memory for the additional data pointed to by the
  16343. msgBuff parameter. If the msgBuff parameter points to an area in memory that is
  16344. not large enough to hold all the data associated with the event,
  16345. AcceptHighLevelEvent returns the result code bufferIsSmall. If
  16346. AcceptHighLevelEvent returns the result code bufferIsSmall, the msgLen parameter
  16347. contains the number of bytes remaining. You can call AcceptHighLevelEvent again
  16348. to receive the rest of the data.
  16349.  
  16350. Result codes
  16351. noErr                0  No error
  16352. bufferIsSmall     –607  Buffer is too small
  16353. noOutstandingHLE  –608  No outstanding high-level event
  16354.  
  16355. æKY GetProcessSerialNumberFromPortName
  16356. æFp EPPC.p
  16357. æT FUNCTION
  16358. æTN A88F
  16359. æD FUNCTION GetProcessSerialNumberFromPortName(portName: PortNamePtr;VAR pPSN: ProcessSerialNumberPtr): OSErr;
  16360.     INLINE $3F3C,$0035,$A88F;
  16361. æDT myVariable := GetProcessSerialNumberFromPortName(portName,pPSN);
  16362. æC 
  16363.  
  16364. æKY GetPortNameFromProcessSerialNumber
  16365. æFp EPPC.p
  16366. æT FUNCTION
  16367. æTN A88F
  16368. æD FUNCTION GetPortNameFromProcessSerialNumber(VAR portName: PortNamePtr;pPSN: ProcessSerialNumberPtr): OSErr;
  16369.     INLINE $3F3C,$0046,$A88F;
  16370. æDT myVariable := GetPortNameFromProcessSerialNumber(portName,pPSN);
  16371. æC 
  16372.  
  16373. æKY GetSpecificHighLevelEvent
  16374. æFp EPPC.p
  16375. æT FUNCTION
  16376. æTN A88F
  16377. æD FUNCTION GetSpecificHighLevelEvent(aFilter: GetSpecificFilterProcPtr;VAR params: unsigned longint;
  16378.     VAR err: OSErr): Boolean;
  16379.     INLINE $3F3C,$0045,$A88F;
  16380. æDT myVariable := GetSpecificHighLevelEvent(aFilter,params,err);
  16381. æC 
  16382. You can use the GetSpecificHighLevelEvent function to select and optionally
  16383. retrieve a specific high-level event from the high-level event queue.
  16384.  
  16385. FUNCTION GetSpecificHighLevelEvent (aFilter:ProcPtr; VAR params: LongInt;
  16386.                                     VAR err: OSErr) : Boolean;
  16387.  
  16388. You specify your filter function in the aFilter parameter.
  16389. GetSpecificHighLevelEvent calls your filter function once for each event on the
  16390. high-level event queue until your filter function returns TRUE or the end of the
  16391. queue is reached. You use the params parameter to specify the criteria your
  16392. filter function should use to select a specific event. For example, you can
  16393. specify the params parameter as a msgRefcon value to search for a particular
  16394. event or as a pointer to a targetID structure to search for a specific sender of
  16395. an event. Or you can search for a specific class of event.
  16396.  
  16397. Here’s how you declare the filter function aFilter:
  16398.  
  16399. FUNCTION aFilter (VAR params: LongInt; msgBuff: HighLevelEventMsgPtr;
  16400.                   sender: TargetID) : Boolean;
  16401.  
  16402. The params parameter indicates the criteria your filter function should use to
  16403. search for a specific event. The msgBuff parameter contains a pointer to a
  16404. record of type HighLevelEventMsg, which provides information about the event:
  16405. the event record for the high-level event, the posting options of the event, and
  16406. so forth. The sender parameter contains the target ID of the application that
  16407. sent the event.
  16408.  
  16409. Your filter function can compare the contents of the params parameter with the
  16410. contents of the msgBuff or senderID parameters. If your filter function finds a
  16411. match, your filter function should return TRUE. If it does not find a match,
  16412. your filter function should return FALSE.
  16413.  
  16414.  
  16415. æKY ErrMgr.p
  16416. æKL AddErrInsert
  16417. CloseErrMgr
  16418. GetSysErrText
  16419. GetToolErrText
  16420. InitErrMgr
  16421.  
  16422. æKY AddErrInsert
  16423. æFp ErrMgr.p
  16424. æT PROCEDURE
  16425. æD PROCEDURE AddErrInsert(insert: Str255;msgString: StringPtr); C;
  16426. æDT AddErrInsert(insert,msgString);
  16427. æC 
  16428. { Add another insert to an error message string.This call is used when more
  16429. than one insert is to be added to a message (because it contains more than
  16430. one '^' character).
  16431.  }
  16432.  
  16433. æKY CloseErrMgr
  16434. æFp ErrMgr.p
  16435. æT PROCEDURE
  16436. æD PROCEDURE CloseErrMgr; C;
  16437. æDT CloseErrMgr;
  16438. æC 
  16439. { Ideally a CloseErrMgr should be done at the end of execution to make sure all
  16440. files opened by the ErrMgr are closed.  You can let normal program termination
  16441. do the closing.  But if you are a purist...
  16442.  }
  16443.  
  16444. æKY GetSysErrText
  16445. æFp ErrMgr.p
  16446. æT PROCEDURE
  16447. æD PROCEDURE GetSysErrText(msgNbr: INTEGER;errMsg: StringPtr);
  16448. æDT GetSysErrText(msgNbr,errMsg);
  16449. æC 
  16450. (* Get the error message text corresponding to system error number errNbr from
  16451. the system error message file (whose name was specified in the InitErrMgr
  16452. call).  The text of the message is returned in errMsg and the function returns
  16453. a pointer to errMsg.  The maximum length of the message is limited to 254
  16454. characters.
  16455.  
  16456. Note, if a system message filename was not specified to InitErrMgr, then the
  16457. ErrMgr assumes the message file contained in the file "SysErrs.Err".  This
  16458. file is first accessed as "                                 {ShellDirectory}SysErrs.Err" on the assumption that
  16459. SysErrs.Err is kept in the same directory as the MPW Shell.  If the file
  16460. cannot be opened, then an open is attempted on "SysErrs.Err" in the System
  16461. Folder. *)
  16462.  
  16463. æKY GetToolErrText
  16464. æFp ErrMgr.p
  16465. æT PROCEDURE
  16466. æD PROCEDURE GetToolErrText(msgNbr: INTEGER;errInsert: Str255;errMsg: StringPtr);
  16467. æDT GetToolErrText(msgNbr,errInsert,errMsg);
  16468. æC 
  16469. (* Get the error message text corresponding to tool error number errNbr from
  16470. the tool error message file (whose name was specified in the InitErrMgr
  16471. call).  The text of the message is returned in errMsg and the function returns
  16472. a pointer to errMsg.  The maximum length of the message is limited to 254
  16473. characters.  If the message is to have an insert, then ErrInsert should be a
  16474. pointer to it.  Otherwise it should be either be a null string or a NULL
  16475. pointer.
  16476.  
  16477. Inserts are indicated in error messages by specifying a '^' to indicate where
  16478. the insert is to be placed.
  16479.  
  16480. Note, if a tool message filename was not specified to InitErrMgr, then the
  16481. ErrMgr assumes the message file contained in the data fork of the tool calling
  16482. the ErrMgr.  This name is contained in the Shell variable   {Command} and the
  16483. value of that variable is used to open the error message file. *)
  16484.  
  16485. æKY InitErrMgr
  16486. æFp ErrMgr.p
  16487. æT PROCEDURE
  16488. æD PROCEDURE InitErrMgr(toolErrFilename: Str255;sysErrFilename: Str255;
  16489.     showToolErrNbrs: BOOLEAN);
  16490. æDT InitErrMgr(toolErrFilename,sysErrFilename,showToolErrNbrs);
  16491. æC 
  16492. { ErrMgr initialization.This must be done before using any other ErrMgr
  16493. routine.  Set showToolErrNbrs to true if you want all tool messages to contain
  16494. the error number following the message text enclosed in parentheses (e.g.,
  16495. "<msg txt> ([OS] Error <n>)"; system error messages always contain the error 
  16496. number).  The toolErrFileName parameter is used to specify the name of a 
  16497. tool-specific error file, and should be the NULL or a null string if not used
  16498. (or if the tool's data fork is to be used as the error file, see
  16499. GetToolErrText for futher details). The sysErrFileName parameter is used to
  16500. specify the name of a system error file, and should normally be the NULL or a
  16501. null string, which causes the ErrMgr to look in the MPW Shell directory for
  16502. "SysErrs.Err" (see GetSysErrText). }
  16503.  
  16504.  
  16505. æKY Errors.p
  16506. æKL SysError
  16507.  
  16508. abortErr
  16509. addRefFailed
  16510. addResFailed
  16511. afpAccessDenied
  16512. afpAuthContinue
  16513. afpBadUAM
  16514. afpBadVersNum
  16515. afpBitmapErr
  16516. afpCallNotSupported
  16517. afpCantMove
  16518. afpCantRename
  16519. afpDenyConflict
  16520. afpDirNotEmpty
  16521. afpDirNotFound
  16522. afpDiskFull
  16523. afpEofError
  16524. afpFileBusy
  16525. afpFlatVol
  16526. afpIconTypeError
  16527. afpItemNotFound
  16528. afpLockErr
  16529. afpMiscErr
  16530. afpNoMoreLocks
  16531. afpNoServer
  16532. afpObjectExists
  16533. afpObjectLocked
  16534. afpObjectNotFound
  16535. afpObjectTypeErr
  16536. afpParmErr
  16537. afpRangeNotLocked
  16538. afpRangeOverlap
  16539. afpServerGoingDown
  16540. afpSessClosed
  16541. afpTooManyFilesOpen
  16542. afpUserNotAuth
  16543. afpVolLocked
  16544. aspBadVersNum
  16545. aspBufTooSmall
  16546. aspNoAck
  16547. aspNoMoreSess
  16548. aspNoServers
  16549. aspParamErr
  16550. aspServerBusy
  16551. aspSessClosed
  16552. aspSizeErr
  16553. aspTooMany
  16554. atpBadRsp
  16555. atpLenErr
  16556. badATPSkt
  16557. badBtSlpErr
  16558. badBuffNum
  16559. badChannel
  16560. badCksmErr
  16561. badDBtSlp
  16562. badDCksum
  16563. badEditionFileErr
  16564. badFormat
  16565. badMDBErr
  16566. badMovErr
  16567. badSectionErr
  16568. badSubPartErr
  16569. badUnitErr
  16570. bdNamErr
  16571. breakRecd
  16572. buf2SmallErr
  16573. cantStepErr
  16574. catChangedErr
  16575. cbNotFound
  16576. cDevErr
  16577. ckSumErr
  16578. clkRdErr
  16579. clkWrErr
  16580. closErr
  16581. cMatchErr
  16582. cNoMemErr
  16583. containerAlreadyOpenWrn
  16584. containerNotFoundWrn
  16585. controlErr
  16586. corErr
  16587. cProtectErr
  16588. cRangeErr
  16589. cResErr
  16590. cTempMemErr
  16591. dataVerErr
  16592. dceExtErr
  16593. ddpLenErr
  16594. ddpSktErr
  16595. DiffVolErr
  16596. dInstErr
  16597. dirFulErr
  16598. dirNFErr
  16599. dRemovErr
  16600. dsAddressErr
  16601. dsBadLaunch
  16602. dsBadPatch
  16603. dsBadSANEopcode
  16604. dsBadSlotInt
  16605. dsBusError
  16606. dsChkErr
  16607. dsCoreErr
  16608. dsFinderErr
  16609. dsFPErr
  16610. dsFSErr
  16611. dsGreeting
  16612. dsHMenuFindErr
  16613. dsIllInstErr
  16614. dsIOCoreErr
  16615. dsIrqErr
  16616. dskFulErr
  16617. dsLineAErr
  16618. dsLineFErr
  16619. dsLoadErr
  16620. dsMBarNFnd
  16621. dsMemFullErr
  16622. dsMiscErr
  16623. dsNoPackErr
  16624. dsNoPatch
  16625. dsNoPk1
  16626. dsNoPk2
  16627. dsNoPk3
  16628. dsNoPk4
  16629. dsNoPk5
  16630. dsNoPk6
  16631. dsNoPk7
  16632. dsNotThe1
  16633. dsOvflowErr
  16634. dsPrivErr
  16635. dsReinsert
  16636. dsStknHeap
  16637. dsSysErr
  16638. dsTraceErr
  16639. dsZeroDivErr
  16640. dupFNErr
  16641. editionMgrInitErr
  16642. envBadVers
  16643. envNotPresent
  16644. envVersTooBig
  16645. eofErr
  16646. evtNotEnb
  16647. excessCollsns
  16648. extFSErr
  16649. extractErr
  16650. exUserBreak
  16651. fBsyErr
  16652. fidExists
  16653. fidNotFound
  16654. firstDskErr
  16655. fLckdErr
  16656. fmt1Err
  16657. fmt2Err
  16658. fnfErr
  16659. fnOpnErr
  16660. fontDecError
  16661. fontNotDeclared
  16662. fontSubErr
  16663. framingErr
  16664. fsDSIntErr
  16665. fsRnErr
  16666. gcrOnMFMErr
  16667. gfpErr
  16668. hMenuFindErr
  16669. hwOverrunErr
  16670. hwParamErr
  16671. iIOAbortErr
  16672. initIWMErr
  16673. ioErr
  16674. lapProtErr
  16675. lastDskErr
  16676. mapReadErr
  16677. mBarNFnd
  16678. memAdrErr
  16679. memAZErr
  16680. memBCErr
  16681. memFullErr
  16682. memLockedErr
  16683. memPCErr
  16684. memPurErr
  16685. memROZErr
  16686. memROZWarn
  16687. memSCErr
  16688. memWZErr
  16689. menuPrgErr
  16690. mFulErr
  16691. multiplePublisherWrn
  16692. nbpBuffOvr
  16693. nbpConfDiff
  16694. nbpDuplicate
  16695. nbpNISErr
  16696. nbpNoConfirm
  16697. nbpNotFound
  16698. negZcbFreeErr
  16699. nilHandleErr
  16700. nmTypErr
  16701. noAdrMkErr
  16702. noBridgeErr
  16703. noDataArea
  16704. noDriveErr
  16705. noDtaMkErr
  16706. noHardware
  16707. noMacDskErr
  16708. noMPPErr
  16709. noNybErr
  16710. noRelErr
  16711. noScrapErr
  16712. noSendResp
  16713. NotAFileErr
  16714. notEnoughHardware
  16715. notOpenErr
  16716. notRegisteredSectionErr
  16717. notThePublisherWrn
  16718. noTypeErr
  16719. nsDrvErr
  16720. nsvErr
  16721. offLinErr
  16722. openErr
  16723. opWrErr
  16724. paramErr
  16725. parityErr
  16726. permErr
  16727. pixMapTooDeepErr
  16728. portInUse
  16729. portNotCf
  16730. posErr
  16731. prInitErr
  16732. prWrErr
  16733. qErr
  16734. queueFull
  16735. rcvrErr
  16736. readErr
  16737. readQErr
  16738. recNotFnd
  16739. reqAborted
  16740. reqFailed
  16741. resAttrErr
  16742. resFNotFound
  16743. resNotFound
  16744. resProblem
  16745. rfNumErr
  16746. rgnTooBigErr
  16747. rmvRefFailed
  16748. rmvResFailed
  16749. sdmInitErr
  16750. sdmJTInitErr
  16751. sdmPRAMInitErr
  16752. sdmPriInitErr
  16753. sdmSRTInitErr
  16754. sectNFErr
  16755. seekErr
  16756. seNoDB
  16757. shutDownAlert
  16758. siInitSDTblErr
  16759. siInitSPTblErr
  16760. siInitVBLQsErr
  16761. sktClosedErr
  16762. slotNumErr
  16763. smBadBoardId
  16764. smBadRefId
  16765. smBadsList
  16766. smBadsPtrErr
  16767. smBLFieldBad
  16768. smBlkMoveErr
  16769. smBusErrTO
  16770. smByteLanesErr
  16771. smCkStatusErr
  16772. smCodeRevErr
  16773. smCPUErr
  16774. smCRCFail
  16775. smDisDrvrNamErr
  16776. smDisposePErr
  16777. smEmptySlot
  16778. smFHBlockRdErr
  16779. smFormatErr
  16780. smGetDrvrNamErr
  16781. smGetPRErr
  16782. smInitStatVErr
  16783. smInitTblErr
  16784. smLWTstBad
  16785. smNewPErr
  16786. smNilsBlockErr
  16787. smNoBoardId
  16788. smNoBoardsRsrc
  16789. smNoDir
  16790. smNoGoodOpens
  16791. smNoJmpTbl
  16792. smNoMoresRsrcs
  16793. smNosInfoArray
  16794. smOffsetErr
  16795. smPRAMInitErr
  16796. smPriInitErr
  16797. smRecNotFnd
  16798. smReservedErr
  16799. smResrvErr
  16800. smRevisionErr
  16801. smSDMInitErr
  16802. smSelOOBErr
  16803. smsGetDrvrErr
  16804. smSlotOOBErr
  16805. smsPointerNil
  16806. smSRTInitErr
  16807. smSRTOvrFlErr
  16808. smUnExBusErr
  16809. spdAdjErr
  16810. statusErr
  16811. strUserBreak
  16812. svDisabled
  16813. svTempDisable
  16814. swOverrunErr
  16815. teScrapSizeErr
  16816. tk0BadErr
  16817. tmfoErr
  16818. tmwdoErr
  16819. tooManyReqs
  16820. tooManySkts
  16821. twoSideErr
  16822. unimpErr
  16823. unitEmptyErr
  16824. unitTblFullErr
  16825. updPixMemErr
  16826. userBreak
  16827. userCanceledErr
  16828. verErr
  16829. vLckdErr
  16830. volGoneErr
  16831. volOffLinErr
  16832. volOnLinErr
  16833. vTypErr
  16834. wPrErr
  16835. wrgVolTypErr
  16836. writErr
  16837. wrPermErr
  16838. wrUnderrun
  16839.  
  16840. æKY qErr
  16841. æFp Errors.p
  16842. æT CONST
  16843. æD qErr = -1; {queue element not found during deletion}
  16844. æC 
  16845.  
  16846. æKY vTypErr
  16847. æFp Errors.p
  16848. æT CONST
  16849. æD vTypErr = -2; {invalid queue element}
  16850. æC 
  16851.  
  16852. æKY corErr
  16853. æFp Errors.p
  16854. æT CONST
  16855. æD corErr = -3; {core routine number out of range}
  16856. æC 
  16857.  
  16858. æKY unimpErr
  16859. æFp Errors.p
  16860. æT CONST
  16861. æD unimpErr = -4; {unimplemented core routine}
  16862. æC 
  16863.  
  16864. æKY seNoDB
  16865. æFp Errors.p
  16866. æT CONST
  16867. æD seNoDB = -8; {no debugger installed to handle debugger command}
  16868. æC 
  16869.  
  16870. æKY controlErr
  16871. æFp Errors.p
  16872. æT CONST
  16873. æD controlErr = -17; {I/O System Errors}
  16874. æC 
  16875.  
  16876. æKY statusErr
  16877. æFp Errors.p
  16878. æT CONST
  16879. æD statusErr = -18; {I/O System Errors}
  16880. æC 
  16881.  
  16882. æKY readErr
  16883. æFp Errors.p
  16884. æT CONST
  16885. æD readErr = -19; {I/O System Errors}
  16886. æC 
  16887.  
  16888. æKY writErr
  16889. æFp Errors.p
  16890. æT CONST
  16891. æD writErr = -20; {I/O System Errors}
  16892. æC 
  16893.  
  16894. æKY badUnitErr
  16895. æFp Errors.p
  16896. æT CONST
  16897. æD badUnitErr = -21; {I/O System Errors}
  16898. æC 
  16899.  
  16900. æKY unitEmptyErr
  16901. æFp Errors.p
  16902. æT CONST
  16903. æD unitEmptyErr = -22; {I/O System Errors}
  16904. æC 
  16905.  
  16906. æKY openErr
  16907. æFp Errors.p
  16908. æT CONST
  16909. æD openErr = -23; {I/O System Errors}
  16910. æC 
  16911.  
  16912. æKY closErr
  16913. æFp Errors.p
  16914. æT CONST
  16915. æD closErr = -24; {I/O System Errors}
  16916. æC 
  16917.  
  16918. æKY dRemovErr
  16919. æFp Errors.p
  16920. æT CONST
  16921. æD dRemovErr = -25; {tried to remove an open driver}
  16922. æC 
  16923.  
  16924. æKY dInstErr
  16925. æFp Errors.p
  16926. æT CONST
  16927. æD dInstErr = -26; {DrvrInstall couldn't find driver in resources }
  16928. æC 
  16929.  
  16930. æKY abortErr
  16931. æFp Errors.p
  16932. æT CONST
  16933. æD abortErr = -27; {IO call aborted by KillIO}
  16934. æC 
  16935.  
  16936. æKY iIOAbortErr
  16937. æFp Errors.p
  16938. æT CONST
  16939. æD iIOAbortErr = -27; {IO abort error (Printing Manager)}
  16940. æC 
  16941.  
  16942. æKY notOpenErr
  16943. æFp Errors.p
  16944. æT CONST
  16945. æD notOpenErr = -28; {Couldn't rd/wr/ctl/sts cause driver not opened}
  16946. æC 
  16947.  
  16948. æKY dirFulErr
  16949. æFp Errors.p
  16950. æT CONST
  16951. æD dirFulErr = -33; {Directory full}
  16952. æC 
  16953.  
  16954. æKY dskFulErr
  16955. æFp Errors.p
  16956. æT CONST
  16957. æD dskFulErr = -34; {disk full}
  16958. æC 
  16959.  
  16960. æKY nsvErr
  16961. æFp Errors.p
  16962. æT CONST
  16963. æD nsvErr = -35; {no such volume}
  16964. æC 
  16965.  
  16966. æKY ioErr
  16967. æFp Errors.p
  16968. æT CONST
  16969. æD ioErr = -36; {I/O error (bummers)}
  16970. æC 
  16971.  
  16972. æKY bdNamErr
  16973. æFp Errors.p
  16974. æT CONST
  16975. æD bdNamErr = -37; {there may be no bad names in the final system!}
  16976. æC 
  16977.  
  16978. æKY fnOpnErr
  16979. æFp Errors.p
  16980. æT CONST
  16981. æD fnOpnErr = -38; {File not open}
  16982. æC 
  16983.  
  16984. æKY eofErr
  16985. æFp Errors.p
  16986. æT CONST
  16987. æD eofErr = -39; {End of file}
  16988. æC 
  16989.  
  16990. æKY posErr
  16991. æFp Errors.p
  16992. æT CONST
  16993. æD posErr = -40; {tried to position to before start of file (r/w)}
  16994. æC 
  16995.  
  16996. æKY mFulErr
  16997. æFp Errors.p
  16998. æT CONST
  16999. æD mFulErr = -41; {memory full (open) or file won't fit (load)}
  17000. æC 
  17001.  
  17002. æKY tmfoErr
  17003. æFp Errors.p
  17004. æT CONST
  17005. æD tmfoErr = -42; {too many files open}
  17006. æC 
  17007.  
  17008. æKY fnfErr
  17009. æFp Errors.p
  17010. æT CONST
  17011. æD fnfErr = -43; {File not found}
  17012. æC 
  17013.  
  17014. æKY wPrErr
  17015. æFp Errors.p
  17016. æT CONST
  17017. æD wPrErr = -44; {diskette is write protected.}
  17018. æC 
  17019.  
  17020. æKY fLckdErr
  17021. æFp Errors.p
  17022. æT CONST
  17023. æD fLckdErr = -45; {file is locked}
  17024. æC 
  17025.  
  17026. æKY vLckdErr
  17027. æFp Errors.p
  17028. æT CONST
  17029. æD vLckdErr = -46; {volume is locked}
  17030. æC 
  17031.  
  17032. æKY fBsyErr
  17033. æFp Errors.p
  17034. æT CONST
  17035. æD fBsyErr = -47; {File is busy (delete)}
  17036. æC 
  17037.  
  17038. æKY dupFNErr
  17039. æFp Errors.p
  17040. æT CONST
  17041. æD dupFNErr = -48; {duplicate filename (rename)}
  17042. æC 
  17043.  
  17044. æKY opWrErr
  17045. æFp Errors.p
  17046. æT CONST
  17047. æD opWrErr = -49; {file already open with with write permission}
  17048. æC 
  17049.  
  17050. æKY paramErr
  17051. æFp Errors.p
  17052. æT CONST
  17053. æD paramErr = -50; {error in user parameter list}
  17054. æC 
  17055.  
  17056. æKY rfNumErr
  17057. æFp Errors.p
  17058. æT CONST
  17059. æD rfNumErr = -51; {refnum error}
  17060. æC 
  17061.  
  17062. æKY gfpErr
  17063. æFp Errors.p
  17064. æT CONST
  17065. æD gfpErr = -52; {get file position error}
  17066. æC 
  17067.  
  17068. æKY volOffLinErr
  17069. æFp Errors.p
  17070. æT CONST
  17071. æD volOffLinErr = -53; {volume not on line error (was Ejected)}
  17072. æC 
  17073.  
  17074. æKY permErr
  17075. æFp Errors.p
  17076. æT CONST
  17077. æD permErr = -54; {permissions error (on file open)}
  17078. æC 
  17079.  
  17080. æKY pixMapTooDeepErr
  17081. æFp Errors.p
  17082. æT CONST
  17083. æD pixMapTooDeepErr = -148;
  17084. æC 
  17085.  
  17086. æKY volOnLinErr
  17087. æFp Errors.p
  17088. æT CONST
  17089. æD volOnLinErr = -55; {drive volume already on-line at MountVol}
  17090. æC 
  17091.  
  17092. æKY nsDrvErr
  17093. æFp Errors.p
  17094. æT CONST
  17095. æD nsDrvErr = -56; {no such drive (tried to mount a bad drive num)}
  17096. æC 
  17097.  
  17098. æKY noMacDskErr
  17099. æFp Errors.p
  17100. æT CONST
  17101. æD noMacDskErr = -57; {not a mac diskette (sig bytes are wrong)}
  17102. æC 
  17103.  
  17104. æKY extFSErr
  17105. æFp Errors.p
  17106. æT CONST
  17107. æD extFSErr = -58; {volume in question belongs to an external fs}
  17108. æC 
  17109.  
  17110. æKY fsRnErr
  17111. æFp Errors.p
  17112. æT CONST
  17113. æD fsRnErr = -59; {file system internal error:during rename the old entry was deleted but could not be restored.}
  17114. æC 
  17115.  
  17116. æKY badMDBErr
  17117. æFp Errors.p
  17118. æT CONST
  17119. æD badMDBErr = -60; {bad master directory block}
  17120. æC 
  17121.  
  17122. æKY wrPermErr
  17123. æFp Errors.p
  17124. æT CONST
  17125. æD wrPermErr = -61; {write permissions error}
  17126. æC 
  17127.  
  17128. æKY fontDecError
  17129. æFp Errors.p
  17130. æT CONST
  17131. æD fontDecError = -64; {error during font declaration}
  17132. æC 
  17133.  
  17134. æKY lastDskErr
  17135. æFp Errors.p
  17136. æT CONST
  17137. æD lastDskErr = -64; {I/O System Errors}
  17138. æC 
  17139.  
  17140. æKY noDriveErr
  17141. æFp Errors.p
  17142. æT CONST
  17143. æD noDriveErr = -64; {drive not installed}
  17144. æC 
  17145.  
  17146. æKY offLinErr
  17147. æFp Errors.p
  17148. æT CONST
  17149. æD offLinErr = -65; {r/w requested for an off-line drive}
  17150. æC 
  17151.  
  17152. æKY fontNotDeclared
  17153. æFp Errors.p
  17154. æT CONST
  17155. æD fontNotDeclared = -65; {font not declared}
  17156. æC 
  17157.  
  17158. æKY noNybErr
  17159. æFp Errors.p
  17160. æT CONST
  17161. æD noNybErr = -66; {couldn't find 5 nybbles in 200 tries}
  17162. æC 
  17163.  
  17164. æKY fontSubErr
  17165. æFp Errors.p
  17166. æT CONST
  17167. æD fontSubErr = -66; {font substitution occured}
  17168. æC 
  17169.  
  17170. æKY noAdrMkErr
  17171. æFp Errors.p
  17172. æT CONST
  17173. æD noAdrMkErr = -67; {couldn't find valid addr mark}
  17174. æC 
  17175.  
  17176. æKY dataVerErr
  17177. æFp Errors.p
  17178. æT CONST
  17179. æD dataVerErr = -68; {read verify compare failed}
  17180. æC 
  17181.  
  17182. æKY badCksmErr
  17183. æFp Errors.p
  17184. æT CONST
  17185. æD badCksmErr = -69; {addr mark checksum didn't check}
  17186. æC 
  17187.  
  17188. æKY badBtSlpErr
  17189. æFp Errors.p
  17190. æT CONST
  17191. æD badBtSlpErr = -70; {bad addr mark bit slip nibbles}
  17192. æC 
  17193.  
  17194. æKY noDtaMkErr
  17195. æFp Errors.p
  17196. æT CONST
  17197. æD noDtaMkErr = -71; {couldn't find a data mark header}
  17198. æC 
  17199.  
  17200. æKY badDCksum
  17201. æFp Errors.p
  17202. æT CONST
  17203. æD badDCksum = -72; {bad data mark checksum}
  17204. æC 
  17205.  
  17206. æKY badDBtSlp
  17207. æFp Errors.p
  17208. æT CONST
  17209. æD badDBtSlp = -73; {bad data mark bit slip nibbles}
  17210. æC 
  17211.  
  17212. æKY wrUnderrun
  17213. æFp Errors.p
  17214. æT CONST
  17215. æD wrUnderrun = -74; {write underrun occurred}
  17216. æC 
  17217.  
  17218. æKY cantStepErr
  17219. æFp Errors.p
  17220. æT CONST
  17221. æD cantStepErr = -75; {step handshake failed}
  17222. æC 
  17223.  
  17224. æKY tk0BadErr
  17225. æFp Errors.p
  17226. æT CONST
  17227. æD tk0BadErr = -76; {track 0 detect doesn't change}
  17228. æC 
  17229.  
  17230. æKY initIWMErr
  17231. æFp Errors.p
  17232. æT CONST
  17233. æD initIWMErr = -77; {unable to initialize IWM}
  17234. æC 
  17235.  
  17236. æKY twoSideErr
  17237. æFp Errors.p
  17238. æT CONST
  17239. æD twoSideErr = -78; {tried to read 2nd side on a 1-sided drive}
  17240. æC 
  17241.  
  17242. æKY spdAdjErr
  17243. æFp Errors.p
  17244. æT CONST
  17245. æD spdAdjErr = -79; {unable to correctly adjust disk speed}
  17246. æC 
  17247.  
  17248. æKY seekErr
  17249. æFp Errors.p
  17250. æT CONST
  17251. æD seekErr = -80; {track number wrong on address mark}
  17252. æC 
  17253.  
  17254. æKY sectNFErr
  17255. æFp Errors.p
  17256. æT CONST
  17257. æD sectNFErr = -81; {sector number never found on a track}
  17258. æC 
  17259.  
  17260. æKY fmt1Err
  17261. æFp Errors.p
  17262. æT CONST
  17263. æD fmt1Err = -82; {can't find sector 0 after track format}
  17264. æC 
  17265.  
  17266. æKY fmt2Err
  17267. æFp Errors.p
  17268. æT CONST
  17269. æD fmt2Err = -83; {can't get enough sync}
  17270. æC 
  17271.  
  17272. æKY verErr
  17273. æFp Errors.p
  17274. æT CONST
  17275. æD verErr = -84; {track failed to verify}
  17276. æC 
  17277.  
  17278. æKY firstDskErr
  17279. æFp Errors.p
  17280. æT CONST
  17281. æD firstDskErr = -84; {I/O System Errors}
  17282. æC 
  17283.  
  17284. æKY clkRdErr
  17285. æFp Errors.p
  17286. æT CONST
  17287. æD clkRdErr = -85; {unable to read same clock value twice}
  17288. æC 
  17289.  
  17290. æKY clkWrErr
  17291. æFp Errors.p
  17292. æT CONST
  17293. æD clkWrErr = -86; {time written did not verify}
  17294. æC 
  17295.  
  17296. æKY prWrErr
  17297. æFp Errors.p
  17298. æT CONST
  17299. æD prWrErr = -87; {parameter ram written didn't read-verify}
  17300. æC 
  17301.  
  17302. æKY prInitErr
  17303. æFp Errors.p
  17304. æT CONST
  17305. æD prInitErr = -88; {InitUtil found the parameter ram uninitialized}
  17306. æC 
  17307.  
  17308. æKY rcvrErr
  17309. æFp Errors.p
  17310. æT CONST
  17311. æD rcvrErr = -89; {SCC receiver error (framing; parity; OR)}
  17312. æC 
  17313.  
  17314. æKY breakRecd
  17315. æFp Errors.p
  17316. æT CONST
  17317. æD breakRecd = -90; {Break received (SCC)}
  17318. æC 
  17319.  
  17320. æKY ddpSktErr
  17321. æFp Errors.p
  17322. æT CONST
  17323. æD ddpSktErr = -91; {error in soket number}
  17324. æC 
  17325.  
  17326. æKY ddpLenErr
  17327. æFp Errors.p
  17328. æT CONST
  17329. æD ddpLenErr = -92; {data length too big}
  17330. æC 
  17331.  
  17332. æKY noBridgeErr
  17333. æFp Errors.p
  17334. æT CONST
  17335. æD noBridgeErr = -93; {no network bridge for non-local send}
  17336. æC 
  17337.  
  17338. æKY lapProtErr
  17339. æFp Errors.p
  17340. æT CONST
  17341. æD lapProtErr = -94; {error in attaching/detaching protocol}
  17342. æC 
  17343.  
  17344. æKY excessCollsns
  17345. æFp Errors.p
  17346. æT CONST
  17347. æD excessCollsns = -95; {excessive collisions on write}
  17348. æC 
  17349.  
  17350. æKY portInUse
  17351. æFp Errors.p
  17352. æT CONST
  17353. æD portInUse = -97; {driver Open error code (port is in use)}
  17354. æC 
  17355.  
  17356. æKY portNotCf
  17357. æFp Errors.p
  17358. æT CONST
  17359. æD portNotCf = -98; {driver Open error code (parameter RAM not configured for this connection)}
  17360. æC 
  17361.  
  17362. æKY memROZErr
  17363. æFp Errors.p
  17364. æT CONST
  17365. æD memROZErr = -99; {hard error in ROZ}
  17366. æC 
  17367.  
  17368. æKY noScrapErr
  17369. æFp Errors.p
  17370. æT CONST
  17371. æD noScrapErr = -100; {No scrap exists error}
  17372. æC 
  17373.  
  17374. æKY noTypeErr
  17375. æFp Errors.p
  17376. æT CONST
  17377. æD noTypeErr = -102; {No object of that type in scrap}
  17378. æC 
  17379.  
  17380. æKY memFullErr
  17381. æFp Errors.p
  17382. æT CONST
  17383. æD memFullErr = -108; {Not enough room in heap zone}
  17384. æC 
  17385.  
  17386. æKY nilHandleErr
  17387. æFp Errors.p
  17388. æT CONST
  17389. æD nilHandleErr = -109; {Master Pointer was NIL in HandleZone or other}
  17390. æC 
  17391.  
  17392. æKY memAdrErr
  17393. æFp Errors.p
  17394. æT CONST
  17395. æD memAdrErr = -110; {address was odd; or out of range}
  17396. æC 
  17397.  
  17398. æKY memWZErr
  17399. æFp Errors.p
  17400. æT CONST
  17401. æD memWZErr = -111; {WhichZone failed (applied to free block)}
  17402. æC 
  17403.  
  17404. æKY memPurErr
  17405. æFp Errors.p
  17406. æT CONST
  17407. æD memPurErr = -112; {trying to purge a locked or non-purgeable block}
  17408. æC 
  17409.  
  17410. æKY memAZErr
  17411. æFp Errors.p
  17412. æT CONST
  17413. æD memAZErr = -113; {Address in zone check failed}
  17414. æC 
  17415.  
  17416. æKY memPCErr
  17417. æFp Errors.p
  17418. æT CONST
  17419. æD memPCErr = -114; {Pointer Check failed}
  17420. æC 
  17421.  
  17422. æKY memBCErr
  17423. æFp Errors.p
  17424. æT CONST
  17425. æD memBCErr = -115; {Block Check failed}
  17426. æC 
  17427.  
  17428. æKY memSCErr
  17429. æFp Errors.p
  17430. æT CONST
  17431. æD memSCErr = -116; {Size Check failed}
  17432. æC 
  17433.  
  17434. æKY memLockedErr
  17435. æFp Errors.p
  17436. æT CONST
  17437. æD memLockedErr = -117; {trying to move a locked block (MoveHHi)}
  17438. æC 
  17439.  
  17440. æKY dirNFErr
  17441. æFp Errors.p
  17442. æT CONST
  17443. æD dirNFErr = -120; {Directory not found}
  17444. æC 
  17445.  
  17446. æKY tmwdoErr
  17447. æFp Errors.p
  17448. æT CONST
  17449. æD tmwdoErr = -121; {No free WDCB available}
  17450. æC 
  17451.  
  17452. æKY badMovErr
  17453. æFp Errors.p
  17454. æT CONST
  17455. æD badMovErr = -122; {Move into offspring error}
  17456. æC 
  17457.  
  17458. æKY wrgVolTypErr
  17459. æFp Errors.p
  17460. æT CONST
  17461. æD wrgVolTypErr = -123; {Wrong volume type error [operation not supported for MFS]}
  17462. æC 
  17463.  
  17464. æKY volGoneErr
  17465. æFp Errors.p
  17466. æT CONST
  17467. æD volGoneErr = -124; {Server volume has been disconnected.}
  17468. æC 
  17469.  
  17470. æKY fsDSIntErr
  17471. æFp Errors.p
  17472. æT CONST
  17473. æD fsDSIntErr = -127; {Internal file system error}
  17474. æC 
  17475.  
  17476. æKY userCanceledErr
  17477. æFp Errors.p
  17478. æT CONST
  17479. æD userCanceledErr = -128;
  17480. æC 
  17481.  
  17482. æKY fidNotFound
  17483. æFp Errors.p
  17484. æT CONST
  17485. æD fidNotFound = -1300; {no file thread exists.}
  17486. æC 
  17487.  
  17488. æKY fidExists
  17489. æFp Errors.p
  17490. æT CONST
  17491. æD fidExists = -1301; {file id already exists}
  17492. æC 
  17493.  
  17494. æKY NotAFileErr
  17495. æFp Errors.p
  17496. æT CONST
  17497. æD NotAFileErr = -1302; {directory specified}
  17498. æC 
  17499.  
  17500. æKY DiffVolErr
  17501. æFp Errors.p
  17502. æT CONST
  17503. æD DiffVolErr = -1303; {files on different volumes}
  17504. æC 
  17505.  
  17506. æKY catChangedErr
  17507. æFp Errors.p
  17508. æT CONST
  17509. æD catChangedErr = -1304; {the catalog has been modified}
  17510. æC 
  17511.  
  17512. æKY resNotFound
  17513. æFp Errors.p
  17514. æT CONST
  17515. æD resNotFound = -192; {Resource not found}
  17516. æC 
  17517.  
  17518. æKY resFNotFound
  17519. æFp Errors.p
  17520. æT CONST
  17521. æD resFNotFound = -193; {Resource file not found}
  17522. æC 
  17523.  
  17524. æKY addResFailed
  17525. æFp Errors.p
  17526. æT CONST
  17527. æD addResFailed = -194; {AddResource failed}
  17528. æC 
  17529.  
  17530. æKY addRefFailed
  17531. æFp Errors.p
  17532. æT CONST
  17533. æD addRefFailed = -195; {AddReference failed}
  17534. æC 
  17535.  
  17536. æKY rmvResFailed
  17537. æFp Errors.p
  17538. æT CONST
  17539. æD rmvResFailed = -196; {RmveResource failed}
  17540. æC 
  17541.  
  17542. æKY rmvRefFailed
  17543. æFp Errors.p
  17544. æT CONST
  17545. æD rmvRefFailed = -197; {RmveReference failed}
  17546. æC 
  17547.  
  17548. æKY resAttrErr
  17549. æFp Errors.p
  17550. æT CONST
  17551. æD resAttrErr = -198; {attribute inconsistent with operation}
  17552. æC 
  17553.  
  17554. æKY mapReadErr
  17555. æFp Errors.p
  17556. æT CONST
  17557. æD mapReadErr = -199; {map inconsistent with operation}
  17558. æC 
  17559.  
  17560. æKY editionMgrInitErr
  17561. æFp Errors.p
  17562. æT CONST
  17563. æD editionMgrInitErr = -450; {edition manager not inited by this app}
  17564. æC 
  17565.  
  17566. æKY badSectionErr
  17567. æFp Errors.p
  17568. æT CONST
  17569. æD badSectionErr = -451; {not a valid SectionRecord}
  17570. æC 
  17571.  
  17572. æKY notRegisteredSectionErr
  17573. æFp Errors.p
  17574. æT CONST
  17575. æD notRegisteredSectionErr = -452; {not a registered SectionRecord}
  17576. æC 
  17577.  
  17578. æKY badEditionFileErr
  17579. æFp Errors.p
  17580. æT CONST
  17581. æD badEditionFileErr = -453; {edition file is corrupt}
  17582. æC 
  17583.  
  17584. æKY badSubPartErr
  17585. æFp Errors.p
  17586. æT CONST
  17587. æD badSubPartErr = -454; {can not use sub parts in this release}
  17588. æC 
  17589.  
  17590. æKY multiplePublisherWrn
  17591. æFp Errors.p
  17592. æT CONST
  17593. æD multiplePublisherWrn = -460; {A Publisher is already registered for that container}
  17594. æC 
  17595.  
  17596. æKY containerNotFoundWrn
  17597. æFp Errors.p
  17598. æT CONST
  17599. æD containerNotFoundWrn = -461; {could not find editionContainer at this time}
  17600. æC 
  17601.  
  17602. æKY containerAlreadyOpenWrn
  17603. æFp Errors.p
  17604. æT CONST
  17605. æD containerAlreadyOpenWrn = -462; {container already opened by this section}
  17606. æC 
  17607.  
  17608. æKY notThePublisherWrn
  17609. æFp Errors.p
  17610. æT CONST
  17611. æD notThePublisherWrn = -463; {not the first registered publisher for that container}
  17612. æC 
  17613.  
  17614. æKY userBreak
  17615. æFp Errors.p
  17616. æT CONST
  17617. æD userBreak = -490; {user debugger break}
  17618. æC 
  17619.  
  17620. æKY strUserBreak
  17621. æFp Errors.p
  17622. æT CONST
  17623. æD strUserBreak = -491; {user debugger break; display string on stack}
  17624. æC 
  17625.  
  17626. æKY exUserBreak
  17627. æFp Errors.p
  17628. æT CONST
  17629. æD exUserBreak = -492; {user debugger break; execute debugger commands on stack}
  17630. æC 
  17631.  
  17632. æKY nbpBuffOvr
  17633. æFp Errors.p
  17634. æT CONST
  17635. æD nbpBuffOvr = -1024; {Buffer overflow in LookupName}
  17636. æC 
  17637.  
  17638. æKY nbpNoConfirm
  17639. æFp Errors.p
  17640. æT CONST
  17641. æD nbpNoConfirm = -1025;
  17642. æC 
  17643.  
  17644. æKY nbpConfDiff
  17645. æFp Errors.p
  17646. æT CONST
  17647. æD nbpConfDiff = -1026; {Name confirmed at different socket}
  17648. æC 
  17649.  
  17650. æKY nbpDuplicate
  17651. æFp Errors.p
  17652. æT CONST
  17653. æD nbpDuplicate = -1027; {Duplicate name exists already}
  17654. æC 
  17655.  
  17656. æKY nbpNotFound
  17657. æFp Errors.p
  17658. æT CONST
  17659. æD nbpNotFound = -1028; {Name not found on remove}
  17660. æC 
  17661.  
  17662. æKY nbpNISErr
  17663. æFp Errors.p
  17664. æT CONST
  17665. æD nbpNISErr = -1029; {Error trying to open the NIS}
  17666. æC 
  17667.  
  17668. æKY aspBadVersNum
  17669. æFp Errors.p
  17670. æT CONST
  17671. æD aspBadVersNum = -1066; {Server cannot support this ASP version}
  17672. æC 
  17673.  
  17674. æKY aspBufTooSmall
  17675. æFp Errors.p
  17676. æT CONST
  17677. æD aspBufTooSmall = -1067; {Buffer too small}
  17678. æC 
  17679.  
  17680. æKY aspNoMoreSess
  17681. æFp Errors.p
  17682. æT CONST
  17683. æD aspNoMoreSess = -1068; {No more sessions on server}
  17684. æC 
  17685.  
  17686. æKY aspNoServers
  17687. æFp Errors.p
  17688. æT CONST
  17689. æD aspNoServers = -1069; {No servers at that address}
  17690. æC 
  17691.  
  17692. æKY aspParamErr
  17693. æFp Errors.p
  17694. æT CONST
  17695. æD aspParamErr = -1070; {Parameter error}
  17696. æC 
  17697.  
  17698. æKY aspServerBusy
  17699. æFp Errors.p
  17700. æT CONST
  17701. æD aspServerBusy = -1071; {Server cannot open another session}
  17702. æC 
  17703.  
  17704. æKY aspSessClosed
  17705. æFp Errors.p
  17706. æT CONST
  17707. æD aspSessClosed = -1072; {Session closed}
  17708. æC 
  17709.  
  17710. æKY aspSizeErr
  17711. æFp Errors.p
  17712. æT CONST
  17713. æD aspSizeErr = -1073; {Command block too big}
  17714. æC 
  17715.  
  17716. æKY aspTooMany
  17717. æFp Errors.p
  17718. æT CONST
  17719. æD aspTooMany = -1074; {Too many clients (server error)}
  17720. æC 
  17721.  
  17722. æKY aspNoAck
  17723. æFp Errors.p
  17724. æT CONST
  17725. æD aspNoAck = -1075; {No ack on attention request (server err)}
  17726. æC 
  17727.  
  17728. æKY reqFailed
  17729. æFp Errors.p
  17730. æT CONST
  17731. æD reqFailed = -1096;
  17732. æC 
  17733.  
  17734. æKY tooManyReqs
  17735. æFp Errors.p
  17736. æT CONST
  17737. æD tooManyReqs = -1097;
  17738. æC 
  17739.  
  17740. æKY tooManySkts
  17741. æFp Errors.p
  17742. æT CONST
  17743. æD tooManySkts = -1098;
  17744. æC 
  17745.  
  17746. æKY badATPSkt
  17747. æFp Errors.p
  17748. æT CONST
  17749. æD badATPSkt = -1099;
  17750. æC 
  17751.  
  17752. æKY badBuffNum
  17753. æFp Errors.p
  17754. æT CONST
  17755. æD badBuffNum = -1100;
  17756. æC 
  17757.  
  17758. æKY noRelErr
  17759. æFp Errors.p
  17760. æT CONST
  17761. æD noRelErr = -1101;
  17762. æC 
  17763.  
  17764. æKY cbNotFound
  17765. æFp Errors.p
  17766. æT CONST
  17767. æD cbNotFound = -1102;
  17768. æC 
  17769.  
  17770. æKY noSendResp
  17771. æFp Errors.p
  17772. æT CONST
  17773. æD noSendResp = -1103;
  17774. æC 
  17775.  
  17776. æKY noDataArea
  17777. æFp Errors.p
  17778. æT CONST
  17779. æD noDataArea = -1104;
  17780. æC 
  17781.  
  17782. æKY reqAborted
  17783. æFp Errors.p
  17784. æT CONST
  17785. æD reqAborted = -1105;
  17786. æC 
  17787.  
  17788. æKY buf2SmallErr
  17789. æFp Errors.p
  17790. æT CONST
  17791. æD buf2SmallErr = -3101;
  17792. æC 
  17793.  
  17794. æKY noMPPErr
  17795. æFp Errors.p
  17796. æT CONST
  17797. æD noMPPErr = -3102;
  17798. æC 
  17799.  
  17800. æKY ckSumErr
  17801. æFp Errors.p
  17802. æT CONST
  17803. æD ckSumErr = -3103;
  17804. æC 
  17805.  
  17806. æKY extractErr
  17807. æFp Errors.p
  17808. æT CONST
  17809. æD extractErr = -3104;
  17810. æC 
  17811.  
  17812. æKY readQErr
  17813. æFp Errors.p
  17814. æT CONST
  17815. æD readQErr = -3105;
  17816. æC 
  17817.  
  17818. æKY atpLenErr
  17819. æFp Errors.p
  17820. æT CONST
  17821. æD atpLenErr = -3106;
  17822. æC 
  17823.  
  17824. æKY atpBadRsp
  17825. æFp Errors.p
  17826. æT CONST
  17827. æD atpBadRsp = -3107;
  17828. æC 
  17829.  
  17830. æKY recNotFnd
  17831. æFp Errors.p
  17832. æT CONST
  17833. æD recNotFnd = -3108;
  17834. æC 
  17835.  
  17836. æKY sktClosedErr
  17837. æFp Errors.p
  17838. æT CONST
  17839. æD sktClosedErr = -3109;
  17840. æC 
  17841.  
  17842. æKY afpAccessDenied
  17843. æFp Errors.p
  17844. æT CONST
  17845. æD afpAccessDenied = -5000;
  17846. æC 
  17847.  
  17848. æKY afpAuthContinue
  17849. æFp Errors.p
  17850. æT CONST
  17851. æD afpAuthContinue = -5001;
  17852. æC 
  17853.  
  17854. æKY afpBadUAM
  17855. æFp Errors.p
  17856. æT CONST
  17857. æD afpBadUAM = -5002;
  17858. æC 
  17859.  
  17860. æKY afpBadVersNum
  17861. æFp Errors.p
  17862. æT CONST
  17863. æD afpBadVersNum = -5003;
  17864. æC 
  17865.  
  17866. æKY afpBitmapErr
  17867. æFp Errors.p
  17868. æT CONST
  17869. æD afpBitmapErr = -5004;
  17870. æC 
  17871.  
  17872. æKY afpCantMove
  17873. æFp Errors.p
  17874. æT CONST
  17875. æD afpCantMove = -5005;
  17876. æC 
  17877.  
  17878. æKY afpDenyConflict
  17879. æFp Errors.p
  17880. æT CONST
  17881. æD afpDenyConflict = -5006;
  17882. æC 
  17883.  
  17884. æKY afpDirNotEmpty
  17885. æFp Errors.p
  17886. æT CONST
  17887. æD afpDirNotEmpty = -5007;
  17888. æC 
  17889.  
  17890. æKY afpDiskFull
  17891. æFp Errors.p
  17892. æT CONST
  17893. æD afpDiskFull = -5008;
  17894. æC 
  17895.  
  17896. æKY afpEofError
  17897. æFp Errors.p
  17898. æT CONST
  17899. æD afpEofError = -5009;
  17900. æC 
  17901.  
  17902. æKY afpFileBusy
  17903. æFp Errors.p
  17904. æT CONST
  17905. æD afpFileBusy = -5010;
  17906. æC 
  17907.  
  17908. æKY afpFlatVol
  17909. æFp Errors.p
  17910. æT CONST
  17911. æD afpFlatVol = -5011;
  17912. æC 
  17913.  
  17914. æKY afpItemNotFound
  17915. æFp Errors.p
  17916. æT CONST
  17917. æD afpItemNotFound = -5012;
  17918. æC 
  17919.  
  17920. æKY memROZWarn
  17921. æFp Errors.p
  17922. æT CONST
  17923. æD memROZWarn = -99; {soft error in ROZ}
  17924. æC 
  17925.  
  17926. æKY afpLockErr
  17927. æFp Errors.p
  17928. æT CONST
  17929. æD afpLockErr = -5013;
  17930. æC 
  17931.  
  17932. æKY afpMiscErr
  17933. æFp Errors.p
  17934. æT CONST
  17935. æD afpMiscErr = -5014;
  17936. æC 
  17937.  
  17938. æKY afpNoMoreLocks
  17939. æFp Errors.p
  17940. æT CONST
  17941. æD afpNoMoreLocks = -5015;
  17942. æC 
  17943.  
  17944. æKY afpNoServer
  17945. æFp Errors.p
  17946. æT CONST
  17947. æD afpNoServer = -5016;
  17948. æC 
  17949.  
  17950. æKY afpObjectExists
  17951. æFp Errors.p
  17952. æT CONST
  17953. æD afpObjectExists = -5017;
  17954. æC 
  17955.  
  17956. æKY afpObjectNotFound
  17957. æFp Errors.p
  17958. æT CONST
  17959. æD afpObjectNotFound = -5018;
  17960. æC 
  17961.  
  17962. æKY afpParmErr
  17963. æFp Errors.p
  17964. æT CONST
  17965. æD afpParmErr = -5019;
  17966. æC 
  17967.  
  17968. æKY afpRangeNotLocked
  17969. æFp Errors.p
  17970. æT CONST
  17971. æD afpRangeNotLocked = -5020;
  17972. æC 
  17973.  
  17974. æKY afpRangeOverlap
  17975. æFp Errors.p
  17976. æT CONST
  17977. æD afpRangeOverlap = -5021;
  17978. æC 
  17979.  
  17980. æKY afpSessClosed
  17981. æFp Errors.p
  17982. æT CONST
  17983. æD afpSessClosed = -5022;
  17984. æC 
  17985.  
  17986. æKY afpUserNotAuth
  17987. æFp Errors.p
  17988. æT CONST
  17989. æD afpUserNotAuth = -5023;
  17990. æC 
  17991.  
  17992. æKY afpCallNotSupported
  17993. æFp Errors.p
  17994. æT CONST
  17995. æD afpCallNotSupported = -5024;
  17996. æC 
  17997.  
  17998. æKY afpObjectTypeErr
  17999. æFp Errors.p
  18000. æT CONST
  18001. æD afpObjectTypeErr = -5025;
  18002. æC 
  18003.  
  18004. æKY afpTooManyFilesOpen
  18005. æFp Errors.p
  18006. æT CONST
  18007. æD afpTooManyFilesOpen = -5026;
  18008. æC 
  18009.  
  18010. æKY afpServerGoingDown
  18011. æFp Errors.p
  18012. æT CONST
  18013. æD afpServerGoingDown = -5027;
  18014. æC 
  18015.  
  18016. æKY afpCantRename
  18017. æFp Errors.p
  18018. æT CONST
  18019. æD afpCantRename = -5028;
  18020. æC 
  18021.  
  18022. æKY afpDirNotFound
  18023. æFp Errors.p
  18024. æT CONST
  18025. æD afpDirNotFound = -5029;
  18026. æC 
  18027.  
  18028. æKY afpIconTypeError
  18029. æFp Errors.p
  18030. æT CONST
  18031. æD afpIconTypeError = -5030;
  18032. æC 
  18033.  
  18034. æKY afpVolLocked
  18035. æFp Errors.p
  18036. æT CONST
  18037. æD afpVolLocked = -5031; {Volume is Read-Only}
  18038. æC 
  18039.  
  18040. æKY afpObjectLocked
  18041. æFp Errors.p
  18042. æT CONST
  18043. æD afpObjectLocked = -5032; {Object is M/R/D/W inhibited}
  18044. æC 
  18045.  
  18046. æKY envNotPresent
  18047. æFp Errors.p
  18048. æT CONST
  18049. æD envNotPresent = -5500; {returned by glue.}
  18050. æC 
  18051.  
  18052. æKY envBadVers
  18053. æFp Errors.p
  18054. æT CONST
  18055. æD envBadVers = -5501; {Version non-positive}
  18056. æC 
  18057.  
  18058. æKY envVersTooBig
  18059. æFp Errors.p
  18060. æT CONST
  18061. æD envVersTooBig = -5502; {Version bigger than call can handle}
  18062. æC 
  18063.  
  18064. æKY evtNotEnb
  18065. æFp Errors.p
  18066. æT CONST
  18067. æD evtNotEnb = 1; {event not enabled at PostEvent}
  18068. æC 
  18069.  
  18070. æKY dsSysErr
  18071. æFp Errors.p
  18072. æT CONST
  18073. æD dsSysErr = 32767; {general system error}
  18074. æC 
  18075.  
  18076. æKY dsBusError
  18077. æFp Errors.p
  18078. æT CONST
  18079. æD dsBusError = 1; {bus error }
  18080. æC 
  18081.  
  18082. æKY dsAddressErr
  18083. æFp Errors.p
  18084. æT CONST
  18085. æD dsAddressErr = 2; {address error}
  18086. æC 
  18087.  
  18088. æKY dsIllInstErr
  18089. æFp Errors.p
  18090. æT CONST
  18091. æD dsIllInstErr = 3; {illegal instruction error}
  18092. æC 
  18093.  
  18094. æKY dsZeroDivErr
  18095. æFp Errors.p
  18096. æT CONST
  18097. æD dsZeroDivErr = 4; {zero divide error}
  18098. æC 
  18099.  
  18100. æKY dsChkErr
  18101. æFp Errors.p
  18102. æT CONST
  18103. æD dsChkErr = 5; {check trap error}
  18104. æC 
  18105.  
  18106. æKY dsOvflowErr
  18107. æFp Errors.p
  18108. æT CONST
  18109. æD dsOvflowErr = 6; {overflow trap error}
  18110. æC 
  18111.  
  18112. æKY dsPrivErr
  18113. æFp Errors.p
  18114. æT CONST
  18115. æD dsPrivErr = 7; {privilege violation error}
  18116. æC 
  18117.  
  18118. æKY dsTraceErr
  18119. æFp Errors.p
  18120. æT CONST
  18121. æD dsTraceErr = 8; {trace mode error}
  18122. æC 
  18123.  
  18124. æKY dsLineAErr
  18125. æFp Errors.p
  18126. æT CONST
  18127. æD dsLineAErr = 9; {line 1010 trap error}
  18128. æC 
  18129.  
  18130. æKY dsLineFErr
  18131. æFp Errors.p
  18132. æT CONST
  18133. æD dsLineFErr = 10; {line 1111 trap error}
  18134. æC 
  18135.  
  18136. æKY dsMiscErr
  18137. æFp Errors.p
  18138. æT CONST
  18139. æD dsMiscErr = 11; {miscellaneous hardware exception error}
  18140. æC 
  18141.  
  18142. æKY dsCoreErr
  18143. æFp Errors.p
  18144. æT CONST
  18145. æD dsCoreErr = 12; {unimplemented core routine error}
  18146. æC 
  18147.  
  18148. æKY dsIrqErr
  18149. æFp Errors.p
  18150. æT CONST
  18151. æD dsIrqErr = 13; {uninstalled interrupt error}
  18152. æC 
  18153.  
  18154. æKY dsIOCoreErr
  18155. æFp Errors.p
  18156. æT CONST
  18157. æD dsIOCoreErr = 14; {IO Core Error}
  18158. æC 
  18159.  
  18160. æKY dsLoadErr
  18161. æFp Errors.p
  18162. æT CONST
  18163. æD dsLoadErr = 15; {Segment Loader Error}
  18164. æC 
  18165.  
  18166. æKY dsFPErr
  18167. æFp Errors.p
  18168. æT CONST
  18169. æD dsFPErr = 16; {Floating point error}
  18170. æC 
  18171.  
  18172. æKY dsNoPackErr
  18173. æFp Errors.p
  18174. æT CONST
  18175. æD dsNoPackErr = 17; {package 0 not present}
  18176. æC 
  18177.  
  18178. æKY dsNoPk1
  18179. æFp Errors.p
  18180. æT CONST
  18181. æD dsNoPk1 = 18; {package 1 not present}
  18182. æC 
  18183.  
  18184. æKY dsNoPk2
  18185. æFp Errors.p
  18186. æT CONST
  18187. æD dsNoPk2 = 19; {package 2 not present}
  18188. æC 
  18189.  
  18190. æKY dsNoPk3
  18191. æFp Errors.p
  18192. æT CONST
  18193. æD dsNoPk3 = 20; {package 3 not present}
  18194. æC 
  18195.  
  18196. æKY dsNoPk4
  18197. æFp Errors.p
  18198. æT CONST
  18199. æD dsNoPk4 = 21; {package 4 not present}
  18200. æC 
  18201.  
  18202. æKY dsNoPk5
  18203. æFp Errors.p
  18204. æT CONST
  18205. æD dsNoPk5 = 22; {package 5 not present}
  18206. æC 
  18207.  
  18208. æKY dsNoPk6
  18209. æFp Errors.p
  18210. æT CONST
  18211. æD dsNoPk6 = 23; {package 6 not present}
  18212. æC 
  18213.  
  18214. æKY dsNoPk7
  18215. æFp Errors.p
  18216. æT CONST
  18217. æD dsNoPk7 = 24; {package 7 not present}
  18218. æC 
  18219.  
  18220. æKY dsMemFullErr
  18221. æFp Errors.p
  18222. æT CONST
  18223. æD dsMemFullErr = 25; {out of memory!}
  18224. æC 
  18225.  
  18226. æKY dsBadLaunch
  18227. æFp Errors.p
  18228. æT CONST
  18229. æD dsBadLaunch = 26; {can't launch file}
  18230. æC 
  18231.  
  18232. æKY dsFSErr
  18233. æFp Errors.p
  18234. æT CONST
  18235. æD dsFSErr = 27; {file system map has been trashed}
  18236. æC 
  18237.  
  18238. æKY dsStknHeap
  18239. æFp Errors.p
  18240. æT CONST
  18241. æD dsStknHeap = 28; {stack has moved into application heap}
  18242. æC 
  18243.  
  18244. æKY dsReinsert
  18245. æFp Errors.p
  18246. æT CONST
  18247. æD dsReinsert = 30; {request user to reinsert off-line volume}
  18248. æC 
  18249.  
  18250. æKY dsNotThe1
  18251. æFp Errors.p
  18252. æT CONST
  18253. æD dsNotThe1 = 31; {not the disk I wanted}
  18254. æC 
  18255.  
  18256. æKY negZcbFreeErr
  18257. æFp Errors.p
  18258. æT CONST
  18259. æD negZcbFreeErr = 33; {ZcbFree has gone negative}
  18260. æC 
  18261.  
  18262. æKY dsGreeting
  18263. æFp Errors.p
  18264. æT CONST
  18265. æD dsGreeting = 40; {welcome to Macintosh greeting}
  18266. æC 
  18267.  
  18268. æKY dsFinderErr
  18269. æFp Errors.p
  18270. æT CONST
  18271. æD dsFinderErr = 41; {can't load the Finder error}
  18272. æC 
  18273.  
  18274. æKY shutDownAlert
  18275. æFp Errors.p
  18276. æT CONST
  18277. æD shutDownAlert = 42; {handled like a shutdown error}
  18278. æC 
  18279.  
  18280. æKY menuPrgErr
  18281. æFp Errors.p
  18282. æT CONST
  18283. æD menuPrgErr = 84; {happens when a menu is purged}
  18284. æC 
  18285.  
  18286. æKY swOverrunErr
  18287. æFp Errors.p
  18288. æT CONST
  18289. æD swOverrunErr = 1; {serial driver error masks}
  18290. æC 
  18291.  
  18292. æKY parityErr
  18293. æFp Errors.p
  18294. æT CONST
  18295. æD parityErr = 16; {serial driver error masks}
  18296. æC 
  18297.  
  18298. æKY hwOverrunErr
  18299. æFp Errors.p
  18300. æT CONST
  18301. æD hwOverrunErr = 32; {serial driver error masks}
  18302. æC 
  18303.  
  18304. æKY framingErr
  18305. æFp Errors.p
  18306. æT CONST
  18307. æD framingErr = 64; {serial driver error masks}
  18308. æC 
  18309.  
  18310. æKY cMatchErr
  18311. æFp Errors.p
  18312. æT CONST
  18313. æD cMatchErr = -150; {Color2Index failed to find an index}
  18314. æC 
  18315.  
  18316. æKY cTempMemErr
  18317. æFp Errors.p
  18318. æT CONST
  18319. æD cTempMemErr = -151; {failed to allocate memory for temporary structures}
  18320. æC 
  18321.  
  18322. æKY cNoMemErr
  18323. æFp Errors.p
  18324. æT CONST
  18325. æD cNoMemErr = -152; {failed to allocate memory for structure}
  18326. æC 
  18327.  
  18328. æKY cRangeErr
  18329. æFp Errors.p
  18330. æT CONST
  18331. æD cRangeErr = -153; {range error on colorTable request}
  18332. æC 
  18333.  
  18334. æKY cProtectErr
  18335. æFp Errors.p
  18336. æT CONST
  18337. æD cProtectErr = -154; {colorTable entry protection violation}
  18338. æC 
  18339.  
  18340. æKY cDevErr
  18341. æFp Errors.p
  18342. æT CONST
  18343. æD cDevErr = -155; {invalid type of graphics device}
  18344. æC 
  18345.  
  18346. æKY cResErr
  18347. æFp Errors.p
  18348. æT CONST
  18349. æD cResErr = -156; {invalid resolution for MakeITable}
  18350. æC 
  18351.  
  18352. æKY unitTblFullErr
  18353. æFp Errors.p
  18354. æT CONST
  18355. æD unitTblFullErr = -29; {unit table has no more entries}
  18356. æC 
  18357.  
  18358. æKY dceExtErr
  18359. æFp Errors.p
  18360. æT CONST
  18361. æD dceExtErr = -30; {dce extension error}
  18362. æC 
  18363.  
  18364. æKY dsBadSlotInt
  18365. æFp Errors.p
  18366. æT CONST
  18367. æD dsBadSlotInt = 51; {unserviceable slot interrupt}
  18368. æC 
  18369.  
  18370. æKY dsBadSANEopcode
  18371. æFp Errors.p
  18372. æT CONST
  18373. æD dsBadSANEopcode = 81; {bad opcode given to SANE Pack4}
  18374. æC 
  18375.  
  18376. æKY dsNoPatch
  18377. æFp Errors.p
  18378. æT CONST
  18379. æD dsNoPatch = 98; {Can't patch for particular Model Mac}
  18380. æC 
  18381.  
  18382. æKY dsBadPatch
  18383. æFp Errors.p
  18384. æT CONST
  18385. æD dsBadPatch = 99; {Can't load patch resource}
  18386. æC 
  18387.  
  18388. æKY updPixMemErr
  18389. æFp Errors.p
  18390. æT CONST
  18391. æD updPixMemErr = -125; {insufficient memory to update a pixmap}
  18392. æC 
  18393.  
  18394. æKY mBarNFnd
  18395. æFp Errors.p
  18396. æT CONST
  18397. æD mBarNFnd = -126; {system error code for MBDF not found}
  18398. æC 
  18399.  
  18400. æKY hMenuFindErr
  18401. æFp Errors.p
  18402. æT CONST
  18403. æD hMenuFindErr = -127; {could not find HMenu's parent in MenuKey}
  18404. æC 
  18405.  
  18406. æKY noHardware
  18407. æFp Errors.p
  18408. æT CONST
  18409. æD noHardware = -200; {Sound Manager Error Returns}
  18410. æC 
  18411.  
  18412. æKY notEnoughHardware
  18413. æFp Errors.p
  18414. æT CONST
  18415. æD notEnoughHardware = -201; {Sound Manager Error Returns}
  18416. æC 
  18417.  
  18418. æKY queueFull
  18419. æFp Errors.p
  18420. æT CONST
  18421. æD queueFull = -203; {Sound Manager Error Returns}
  18422. æC 
  18423.  
  18424. æKY resProblem
  18425. æFp Errors.p
  18426. æT CONST
  18427. æD resProblem = -204; {Sound Manager Error Returns}
  18428. æC 
  18429.  
  18430. æKY badChannel
  18431. æFp Errors.p
  18432. æT CONST
  18433. æD badChannel = -205; {Sound Manager Error Returns}
  18434. æC 
  18435.  
  18436. æKY badFormat
  18437. æFp Errors.p
  18438. æT CONST
  18439. æD badFormat = -206; {Sound Manager Error Returns}
  18440. æC 
  18441.  
  18442. æKY smSDMInitErr
  18443. æFp Errors.p
  18444. æT CONST
  18445. æD smSDMInitErr = -290; {Error; SDM could not be initialized.}
  18446. æC 
  18447.  
  18448. æKY smSRTInitErr
  18449. æFp Errors.p
  18450. æT CONST
  18451. æD smSRTInitErr = -291; {Error; Slot Resource Table could not be initialized.}
  18452. æC 
  18453.  
  18454. æKY smPRAMInitErr
  18455. æFp Errors.p
  18456. æT CONST
  18457. æD smPRAMInitErr = -292; {Error; Slot Resource Table could not be initialized.}
  18458. æC 
  18459.  
  18460. æKY smPriInitErr
  18461. æFp Errors.p
  18462. æT CONST
  18463. æD smPriInitErr = -293; {Error; Cards could not be initialized.}
  18464. æC 
  18465.  
  18466. æKY nmTypErr
  18467. æFp Errors.p
  18468. æT CONST
  18469. æD nmTypErr = -299;
  18470. æC 
  18471.  
  18472. æKY smEmptySlot
  18473. æFp Errors.p
  18474. æT CONST
  18475. æD smEmptySlot = -300; {No card in slot}
  18476. æC 
  18477.  
  18478. æKY smCRCFail
  18479. æFp Errors.p
  18480. æT CONST
  18481. æD smCRCFail = -301; {CRC check failed for declaration data}
  18482. æC 
  18483.  
  18484. æKY smFormatErr
  18485. æFp Errors.p
  18486. æT CONST
  18487. æD smFormatErr = -302; {FHeader Format is not Apple's}
  18488. æC 
  18489.  
  18490. æKY smRevisionErr
  18491. æFp Errors.p
  18492. æT CONST
  18493. æD smRevisionErr = -303; {Wrong revison level}
  18494. æC 
  18495.  
  18496. æKY smNoDir
  18497. æFp Errors.p
  18498. æT CONST
  18499. æD smNoDir = -304; {Directory offset is Nil }
  18500. æC 
  18501.  
  18502. æKY smLWTstBad
  18503. æFp Errors.p
  18504. æT CONST
  18505. æD smLWTstBad = -305; {Long Word test field <> $5A932BC7.}
  18506. æC 
  18507.  
  18508. æKY smNosInfoArray
  18509. æFp Errors.p
  18510. æT CONST
  18511. æD smNosInfoArray = -306; {No sInfoArray. Memory Mgr error.}
  18512. æC 
  18513.  
  18514. æKY smResrvErr
  18515. æFp Errors.p
  18516. æT CONST
  18517. æD smResrvErr = -307; {Fatal reserved error. Resreved field <> 0.}
  18518. æC 
  18519.  
  18520. æKY smUnExBusErr
  18521. æFp Errors.p
  18522. æT CONST
  18523. æD smUnExBusErr = -308; {Unexpected BusError}
  18524. æC 
  18525.  
  18526. æKY smBLFieldBad
  18527. æFp Errors.p
  18528. æT CONST
  18529. æD smBLFieldBad = -309; {ByteLanes field was bad.}
  18530. æC 
  18531.  
  18532. æKY smFHBlockRdErr
  18533. æFp Errors.p
  18534. æT CONST
  18535. æD smFHBlockRdErr = -310; {Error occured during _sGetFHeader.}
  18536. æC 
  18537.  
  18538. æKY smDisposePErr
  18539. æFp Errors.p
  18540. æT CONST
  18541. æD smDisposePErr = -312; {_DisposePointer error}
  18542. æC 
  18543.  
  18544. æKY smNoBoardsRsrc
  18545. æFp Errors.p
  18546. æT CONST
  18547. æD smNoBoardsRsrc = -313; {No Board sResource.}
  18548. æC 
  18549.  
  18550. æKY smGetPRErr
  18551. æFp Errors.p
  18552. æT CONST
  18553. æD smGetPRErr = -314; {Error occured during _sGetPRAMRec (See SIMStatus).}
  18554. æC 
  18555.  
  18556. æKY smNoBoardId
  18557. æFp Errors.p
  18558. æT CONST
  18559. æD smNoBoardId = -315; {No Board Id.}
  18560. æC 
  18561.  
  18562. æKY smInitStatVErr
  18563. æFp Errors.p
  18564. æT CONST
  18565. æD smInitStatVErr = -316; {The InitStatusV field was negative after primary or secondary init.}
  18566. æC 
  18567.  
  18568. æKY smInitTblErr
  18569. æFp Errors.p
  18570. æT CONST
  18571. æD smInitTblErr = -317; {An error occured while trying to initialize the Slot Resource Table.}
  18572. æC 
  18573.  
  18574. æKY smNoJmpTbl
  18575. æFp Errors.p
  18576. æT CONST
  18577. æD smNoJmpTbl = -318; {SDM jump table could not be created.}
  18578. æC 
  18579.  
  18580. æKY smBadBoardId
  18581. æFp Errors.p
  18582. æT CONST
  18583. æD smBadBoardId = -319; {BoardId was wrong; re-init the PRAM record.}
  18584. æC 
  18585.  
  18586. æKY smBusErrTO
  18587. æFp Errors.p
  18588. æT CONST
  18589. æD smBusErrTO = -320; {BusError time out.}
  18590. æC 
  18591.  
  18592. æKY smBadRefId
  18593. æFp Errors.p
  18594. æT CONST
  18595. æD smBadRefId = -330; {Reference Id not found in List}
  18596. æC 
  18597.  
  18598. æKY smBadsList
  18599. æFp Errors.p
  18600. æT CONST
  18601. æD smBadsList = -331; {Bad sList: Id1 < Id2 < Id3 ...format is not followed.}
  18602. æC 
  18603.  
  18604. æKY smReservedErr
  18605. æFp Errors.p
  18606. æT CONST
  18607. æD smReservedErr = -332; {Reserved field not zero}
  18608. æC 
  18609.  
  18610. æKY smCodeRevErr
  18611. æFp Errors.p
  18612. æT CONST
  18613. æD smCodeRevErr = -333; {Code revision is wrong}
  18614. æC 
  18615.  
  18616. æKY smCPUErr
  18617. æFp Errors.p
  18618. æT CONST
  18619. æD smCPUErr = -334; {Code revision is wrong}
  18620. æC 
  18621.  
  18622. æKY smsPointerNil
  18623. æFp Errors.p
  18624. æT CONST
  18625. æD smsPointerNil = -335; {LPointer is nil From sOffsetData. If this error occurs; check sInfo rec for more information.}
  18626. æC 
  18627.  
  18628. æKY smNilsBlockErr
  18629. æFp Errors.p
  18630. æT CONST
  18631. æD smNilsBlockErr = -336; {Nil sBlock error (Dont allocate and try to use a nil sBlock)}
  18632. æC 
  18633.  
  18634. æKY smSlotOOBErr
  18635. æFp Errors.p
  18636. æT CONST
  18637. æD smSlotOOBErr = -337; {Slot out of bounds error}
  18638. æC 
  18639.  
  18640. æKY smSelOOBErr
  18641. æFp Errors.p
  18642. æT CONST
  18643. æD smSelOOBErr = -338; {Selector out of bounds error}
  18644. æC 
  18645.  
  18646. æKY smNewPErr
  18647. æFp Errors.p
  18648. æT CONST
  18649. æD smNewPErr = -339; {_NewPtr error}
  18650. æC 
  18651.  
  18652. æKY smBlkMoveErr
  18653. æFp Errors.p
  18654. æT CONST
  18655. æD smBlkMoveErr = -340; {_BlockMove error}
  18656. æC 
  18657.  
  18658. æKY smCkStatusErr
  18659. æFp Errors.p
  18660. æT CONST
  18661. æD smCkStatusErr = -341; {Status of slot = fail.}
  18662. æC 
  18663.  
  18664. æKY smGetDrvrNamErr
  18665. æFp Errors.p
  18666. æT CONST
  18667. æD smGetDrvrNamErr = -342; {Error occured during _sGetDrvrName.}
  18668. æC 
  18669.  
  18670. æKY smDisDrvrNamErr
  18671. æFp Errors.p
  18672. æT CONST
  18673. æD smDisDrvrNamErr = -343; {Error occured during _sDisDrvrName.}
  18674. æC 
  18675.  
  18676. æKY smNoMoresRsrcs
  18677. æFp Errors.p
  18678. æT CONST
  18679. æD smNoMoresRsrcs = -344; {No more sResources}
  18680. æC 
  18681.  
  18682. æKY smsGetDrvrErr
  18683. æFp Errors.p
  18684. æT CONST
  18685. æD smsGetDrvrErr = -345; {Error occurred during _sGetDriver.}
  18686. æC 
  18687.  
  18688. æKY smBadsPtrErr
  18689. æFp Errors.p
  18690. æT CONST
  18691. æD smBadsPtrErr = -346; {Bad pointer was passed to sCalcsPointer}
  18692. æC 
  18693.  
  18694. æKY smByteLanesErr
  18695. æFp Errors.p
  18696. æT CONST
  18697. æD smByteLanesErr = -347; {NumByteLanes was determined to be zero.}
  18698. æC 
  18699.  
  18700. æKY smOffsetErr
  18701. æFp Errors.p
  18702. æT CONST
  18703. æD smOffsetErr = -348; {Offset was too big (temporary error}
  18704. æC 
  18705.  
  18706. æKY smNoGoodOpens
  18707. æFp Errors.p
  18708. æT CONST
  18709. æD smNoGoodOpens = -349; {No opens were successfull in the loop.}
  18710. æC 
  18711.  
  18712. æKY smSRTOvrFlErr
  18713. æFp Errors.p
  18714. æT CONST
  18715. æD smSRTOvrFlErr = -350; {SRT over flow.}
  18716. æC 
  18717.  
  18718. æKY smRecNotFnd
  18719. æFp Errors.p
  18720. æT CONST
  18721. æD smRecNotFnd = -351; {Record not found in the SRT.}
  18722. æC 
  18723.  
  18724. æKY slotNumErr
  18725. æFp Errors.p
  18726. æT CONST
  18727. æD slotNumErr = -360; {invalid slot # error}
  18728. æC 
  18729.  
  18730. æKY gcrOnMFMErr
  18731. æFp Errors.p
  18732. æT CONST
  18733. æD gcrOnMFMErr = -400; {gcr format on high density media error}
  18734. æC 
  18735.  
  18736. æKY rgnTooBigErr
  18737. æFp Errors.p
  18738. æT CONST
  18739. æD rgnTooBigErr = -500;
  18740. æC 
  18741.  
  18742. æKY teScrapSizeErr
  18743. æFp Errors.p
  18744. æT CONST
  18745. æD teScrapSizeErr = -501; {scrap item too big for text edit record}
  18746. æC 
  18747.  
  18748. æKY hwParamErr
  18749. æFp Errors.p
  18750. æT CONST
  18751. æD hwParamErr = -502; {bad selector for _HWPriv}
  18752. æC 
  18753.  
  18754. æKY svTempDisable
  18755. æFp Errors.p
  18756. æT CONST
  18757. æD 
  18758. {  The following errors are for primary or secondary init code.  The errors are logged in the
  18759. vendor status field of the sInfo record.  Normally the vendor error is not Apple's concern,
  18760. but a special error is needed to patch secondary inits.
  18761.  
  18762.  }
  18763.  
  18764. svTempDisable = -32768; {Temporarily disable card but run primary init.}
  18765. æC 
  18766.  
  18767. æKY svDisabled
  18768. æFp Errors.p
  18769. æT CONST
  18770. æD svDisabled = -32640; {Reserve range -32640 to -32768 for Apple temp disables.}
  18771. æC 
  18772.  
  18773. æKY siInitSDTblErr
  18774. æFp Errors.p
  18775. æT CONST
  18776. æD siInitSDTblErr = 1; {slot int dispatch table could not be initialized.}
  18777. æC 
  18778.  
  18779. æKY siInitVBLQsErr
  18780. æFp Errors.p
  18781. æT CONST
  18782. æD siInitVBLQsErr = 2; {VBLqueues for all slots could not be initialized.}
  18783. æC 
  18784.  
  18785. æKY siInitSPTblErr
  18786. æFp Errors.p
  18787. æT CONST
  18788. æD siInitSPTblErr = 3; {slot priority table could not be initialized.}
  18789. æC 
  18790.  
  18791. æKY sdmJTInitErr
  18792. æFp Errors.p
  18793. æT CONST
  18794. æD sdmJTInitErr = 10; {SDM Jump Table could not be initialized.}
  18795. æC 
  18796.  
  18797. æKY sdmInitErr
  18798. æFp Errors.p
  18799. æT CONST
  18800. æD sdmInitErr = 11; {SDM could not be initialized.}
  18801. æC 
  18802.  
  18803. æKY sdmSRTInitErr
  18804. æFp Errors.p
  18805. æT CONST
  18806. æD sdmSRTInitErr = 12; {Slot Resource Table could not be initialized.}
  18807. æC 
  18808.  
  18809. æKY sdmPRAMInitErr
  18810. æFp Errors.p
  18811. æT CONST
  18812. æD sdmPRAMInitErr = 13; {Slot PRAM could not be initialized.}
  18813. æC 
  18814.  
  18815. æKY sdmPriInitErr
  18816. æFp Errors.p
  18817. æT CONST
  18818. æD sdmPriInitErr = 14; {Cards could not be initialized.}
  18819. æC 
  18820.  
  18821. æKY dsMBarNFnd
  18822. æFp Errors.p
  18823. æT CONST
  18824. æD dsMBarNFnd = 85; {Menu Manager Errors}
  18825. æC 
  18826.  
  18827. æKY dsHMenuFindErr
  18828. æFp Errors.p
  18829. æT CONST
  18830. æD dsHMenuFindErr = 86; {Menu Manager Errors}
  18831. æC 
  18832.  
  18833. æKY SysError
  18834. æFp Errors.p
  18835. æT PROCEDURE
  18836. æD PROCEDURE SysError(errorCode: INTEGER);
  18837.     INLINE $301F,$A9C9;
  18838. æDT SysError(errorCode);
  18839. æMM
  18840. æRI II-362, V-572
  18841. æC _____________________________________________________________________________________
  18842.  
  18843. Trap macro  _SysError
  18844. On entry    D0:  errorCode (word)
  18845. On exit     All registers changed
  18846. _____________________________________________________________________________________
  18847. SysError generates a system error with the ID specified by the errorCode 
  18848. parameter.
  18849.  
  18850. It takes the following precise steps:
  18851. 1.  It saves all registers and the stack pointer.
  18852. 2.  It stores the system error ID in a global variable (named DSErrCode).
  18853. 3.  It checks to see whether there's a system error alert table in memory (by 
  18854.     testing whether the global variable DSAlertTab is 0); if there isn't, it draws 
  18855.     the "sad Macintosh" icon.
  18856. 4.  It allocates memory for QuickDraw globals on the stack, initializes 
  18857.     QuickDraw, and initializes a grafPort in which the alert box will be drawn.
  18858. 5.  It checks the system error ID.  If the system error ID is negative, the alert 
  18859.     box isn't redrawn (this is used for system startup alerts, which can display a 
  18860.     sequence of consecutive messages in the same box).  If the system error ID 
  18861.     doesn't correspond to an entry in the system error alert table, the default 
  18862.     alert definition at the start of the table will be used, displaying the message 
  18863.     "Sorry, a system error occurred".
  18864. 6.  It draws an alert box (in the rectangle specified by the global variable 
  18865.     DSAlertRect).
  18866. 7.  If the text definition IDs in the alert definition for this alert aren't 0, it 
  18867.     draws both strings.
  18868. 8.  If the icon definition ID in the alert definition isn't 0, it draws the icon.
  18869. 9.  If the procedure definition ID in the alert definition isn't 0, it invokes the 
  18870.     procedure with the specified ID.
  18871. 10. If the button definition ID in the alert definition is 0, it returns control to 
  18872.     the procedure that called it (this is used during the disk-switch alert to return
  18873.     control to the File Manager after the "Please insert the disk:" message has been 
  18874.     displayed).
  18875. 11. If there's a resume procedure, it increments the button definition ID by 1.
  18876. 12. It draws the buttons.
  18877. 13. It hit-tests the buttons and calls the corresponding procedure code when a 
  18878.     button is pressed.  If there's no procedure code, it returns to the procedure 
  18879.     that called it.
  18880.  
  18881. User Alerts
  18882. _____________
  18883. ID  Explanation
  18884. 1   Bus error:  Invalid memory reference; happens only on a Macintosh XL 
  18885. 2   Address error:  Word or long-word reference made to an odd address
  18886. 3   Illegal instruction:  The MC68000 received an instruction it didn't recognize.
  18887. 4   Zero divide:  Signed Divide (DIVS) or Unsigned Divide (DIVU) instruction 
  18888.                   with a divisor of 0 was executed.
  18889. 5   Check exception:  Check Register Against Bounds (CHK) instruction was executed 
  18890.                       and failed.  Pascal "value out of range" errors are usually 
  18891.                       reported in this way.
  18892. 6   TrapV exception:  Trap On Overflow (TRAPV) instruction was executed and failed.
  18893. 7   Privilege violation:  Macintosh always runs in supervisor mode; perhaps an 
  18894.                           erroneous Return From Execution (RTE) instruction was 
  18895.                           executed.
  18896. 8   Trace exception:  The trace bit in the status register is set.
  18897. 9   Line 1010 exception:  The 1010 trap dispatcher has failed.
  18898. 10  Line 1111 exception:  Unimplemented instruction
  18899. 11  Miscellaneous exception:  All other MC68000 exceptions
  18900. 12  Unimplemented core routine:  An unimplemented trap number was encountered.
  18901. 13  Spurious interrupt:  The interrupt vector table entry for a particular level 
  18902.                          of interrupt is NIL; usually occurs with level 4, 5, 6, or 7 
  18903.                          interrupts.
  18904. 14  I/O system error:  The File Manager is attempting to dequeue an entry from 
  18905.                        an I/O request queue that has a bad queue type field; perhaps 
  18906.                        the queue entry is unlocked.  Or, the dCtlQHead field was NIL 
  18907.                        during a Fetch or Stash call.  Or, a needed device control 
  18908.                        entry has been purged.
  18909. 15  Segment Loader error:  A GetResource call to read a segment into memory failed.
  18910. 16  Floating point error:  The halt bit in the floating-point environment word was 
  18911.                            set.
  18912. 17-24 Can't load package:  A GetResource call to read a package into memory failed.
  18913. 25  Can't allocate requested memory block in the heap
  18914. 26  Segment Loader error:  A GetResource call to read 'CODE' resource 0 into 
  18915.                            memory failed; usually indicates a nonexecutable file.
  18916. 27  File map destroyed:  A logical block number was found that's greater than 
  18917.                          the number of the last logical block on the volume or less 
  18918.                          than the logical block number of the first allocation block 
  18919.                          on the volume.
  18920. 28  Stack overflow error:  The stack has expanded into the heap.
  18921. 30  "Please insert the disk:" File Manager alert
  18922. 41  The file named "Finder" can't be found on the disk.
  18923. 100 Can't mount system startup volume.  The system couldn't read the system resource 
  18924.                                         file into memory.
  18925. 32767 "Sorry, a system error occurred":  Default alert message 
  18926.  
  18927.  
  18928. æKY Events.p
  18929. æKL Button
  18930. EventAvail
  18931. GetCaretTime
  18932. GetDblTime
  18933. GetKeys
  18934. GetMouse
  18935. GetNextEvent
  18936. StillDown
  18937. TickCount
  18938. WaitMouseUp
  18939. WaitNextEvent
  18940.  
  18941. activateEvt
  18942. activeFlag
  18943. activMask
  18944. adbAddrMask
  18945. alphaLock
  18946. app1Evt
  18947. app1Mask
  18948. app2Evt
  18949. app2Mask
  18950. app3Evt
  18951. app3Mask
  18952. app4Evt
  18953. app4Mask
  18954. autoKey
  18955. autoKeyMask
  18956. btnState
  18957. charCodeMask
  18958. childDiedMessage
  18959. cmdKey
  18960. controlKey
  18961. diskEvt
  18962. diskMask
  18963. driverEvt
  18964. driverMask
  18965. EventRecord
  18966. everyEvent
  18967. keyCodeMask
  18968. keyDown
  18969. keyDownMask
  18970. KeyMap
  18971. keyUp
  18972. keyUpMask
  18973. mDownMask
  18974. mouseDown
  18975. mouseMovedMessage
  18976. mouseUp
  18977. mUpMask
  18978. networkEvt
  18979. networkMask
  18980. nullEvent
  18981. optionKey
  18982. osEvt
  18983. osEvtMessageMask
  18984. shiftKey
  18985. suspendResumeMessage
  18986. updateEvt
  18987. updateMask
  18988.  
  18989. æKY nullEvent
  18990. æFp Events.p
  18991. æT CONST
  18992. æD nullEvent = 0;
  18993. æC 
  18994. »Event Code
  18995.  
  18996. The what field of an event record contains an event code identifying the type of the
  18997. event. The event codes are available as predefined constants:
  18998.  
  18999. CONST  nullEvent   =  0;    {null}
  19000.        mouseDown   =  1;    {mouse-down}
  19001.        mouseUp     =  2;    {mouse-up}
  19002.        keyDown     =  3;    {key-down}
  19003.        keyUp       =  4;    {key-up}
  19004.        autoKey     =  5;    {auto-key}
  19005.        updateEvt   =  6;    {update}
  19006.        diskEvt     =  7;    {disk-inserted}
  19007.        activateEvt =  8;    {activate}
  19008.        networkEvt  = 10;    {network}
  19009.        driverEvt   = 11;    {device driver}
  19010.        app1Evt     = 12;    {application-defined}
  19011.        app2Evt     = 13;    {application-defined}
  19012.        app3Evt     = 14;    {application-defined}
  19013.        app4Evt     = 15;    {application-defined}
  19014.  
  19015. æKY mouseDown
  19016. æFp Events.p
  19017. æT CONST
  19018. æD mouseDown = 1;
  19019. æC 
  19020.  
  19021. æKY mouseUp
  19022. æFp Events.p
  19023. æT CONST
  19024. æD mouseUp = 2;
  19025. æC 
  19026.  
  19027. æKY keyDown
  19028. æFp Events.p
  19029. æT CONST
  19030. æD keyDown = 3;
  19031. æC 
  19032.  
  19033. æKY keyUp
  19034. æFp Events.p
  19035. æT CONST
  19036. æD keyUp = 4;
  19037. æC 
  19038.  
  19039. æKY autoKey
  19040. æFp Events.p
  19041. æT CONST
  19042. æD autoKey = 5;
  19043. æC 
  19044.  
  19045. æKY updateEvt
  19046. æFp Events.p
  19047. æT CONST
  19048. æD updateEvt = 6;
  19049. æC 
  19050.  
  19051. æKY diskEvt
  19052. æFp Events.p
  19053. æT CONST
  19054. æD diskEvt = 7;
  19055. æC 
  19056.  
  19057. æKY activateEvt
  19058. æFp Events.p
  19059. æT CONST
  19060. æD activateEvt = 8;
  19061. æC 
  19062.  
  19063. æKY networkEvt
  19064. æFp Events.p
  19065. æT CONST
  19066. æD networkEvt = 10;
  19067. æC 
  19068.  
  19069. æKY driverEvt
  19070. æFp Events.p
  19071. æT CONST
  19072. æD driverEvt = 11;
  19073. æC 
  19074.  
  19075. æKY app1Evt
  19076. æFp Events.p
  19077. æT CONST
  19078. æD app1Evt = 12;
  19079. æC 
  19080.  
  19081. æKY app2Evt
  19082. æFp Events.p
  19083. æT CONST
  19084. æD app2Evt = 13;
  19085. æC 
  19086.  
  19087. æKY app3Evt
  19088. æFp Events.p
  19089. æT CONST
  19090. æD app3Evt = 14;
  19091. æC 
  19092.  
  19093. æKY app4Evt
  19094. æFp Events.p
  19095. æT CONST
  19096. æD app4Evt = 15;
  19097. æC 
  19098.  
  19099. æKY osEvt
  19100. æFp Events.p
  19101. æT CONST
  19102. æD osEvt = app4Evt;
  19103. æC 
  19104.  
  19105. æKY charCodeMask
  19106. æFp Events.p
  19107. æT CONST
  19108. æD charCodeMask = $000000FF;
  19109. æC 
  19110.  
  19111. æKY keyCodeMask
  19112. æFp Events.p
  19113. æT CONST
  19114. æD keyCodeMask = $0000FF00;
  19115. æC 
  19116.  
  19117. æKY adbAddrMask
  19118. æFp Events.p
  19119. æT CONST
  19120. æD adbAddrMask = $00FF0000;
  19121. æC 
  19122.  
  19123. æKY osEvtMessageMask
  19124. æFp Events.p
  19125. æT CONST
  19126. æD osEvtMessageMask = $FF000000;
  19127. æC 
  19128.  
  19129. æKY mouseMovedMessage
  19130. æFp Events.p
  19131. æT CONST
  19132. æD 
  19133. { OSEvent Messages }
  19134.  
  19135. mouseMovedMessage = $FA;
  19136. æC 
  19137.  
  19138. æKY childDiedMessage
  19139. æFp Events.p
  19140. æT CONST
  19141. æD childDiedMessage = $FD;
  19142. æC 
  19143.  
  19144. æKY suspendResumeMessage
  19145. æFp Events.p
  19146. æT CONST
  19147. æD suspendResumeMessage = $01;
  19148. æC 
  19149.  
  19150. æKY mDownMask
  19151. æFp Events.p
  19152. æT CONST
  19153. æD 
  19154. { event mask equates }
  19155.  
  19156. mDownMask = 2;
  19157. æC 
  19158. _______________________________________________________________________________
  19159.  
  19160. »EVENT MASKS
  19161. _______________________________________________________________________________
  19162.  
  19163. Some of the Event Manager routines can be restricted to operate on a specific event
  19164. type or group of types; in other words, the specified event types are enabled while
  19165. all others are disabled. For instance, instead of just requesting the next available
  19166. event, you can specifically ask for the next keyboard event.
  19167.  
  19168. You specify which event types a particular Event Manager call applies to by supplying
  19169. an event mask as a parameter. This is an integer in which there’s one bit position
  19170. for each event type, as shown in Figure 8. The bit position representing a given type
  19171. corresponds to the event code for that type—for example, update events (event code 6)
  19172. are specified by bit 6 of the mask. A 1 in bit 6 means that this Event Manager call
  19173. applies to update events; a 0 means that it doesn’t.
  19174.  
  19175. •••Refer to Figure 8.•••
  19176.  
  19177. Figure 8–Event Mask
  19178.  
  19179. Masks for each individual event type are available as predefined constants:
  19180.  
  19181. CONST  mDownMask   = 2;       {mouse-down}
  19182.        mUpMask     = 4;       {mouse-up}
  19183.        keyDownMask = 8;       {key-down}
  19184.        keyUpMask   = 16;      {key-up}
  19185.        autoKeyMask = 32;      {auto-key}
  19186.        updateMask  = 64;      {update}
  19187.        diskMask    = 128;     {disk-inserted}
  19188.        activMask   = 256;     {activate}
  19189.        networkMask = 1024;    {network}
  19190.        driverMask  = 2048;    {device driver}
  19191.        app1Mask    = 4096;    {application-defined}
  19192.        app2Mask    = 8192;    {application-defined}
  19193.        app3Mask    = 16384;   {application-defined}
  19194.        app4Mask    = -32768;  {application-defined}
  19195.  
  19196. Note:  Null events can’t be disabled; a null event will always be reported
  19197.        when none of the enabled types of events are available.
  19198.  
  19199. The following predefined mask designates all event types:
  19200.  
  19201. CONST    everyEvent    = -1;    {all event types}
  19202.  
  19203. You can form any mask you need by adding or subtracting these mask constants. For
  19204. example, to specify every keyboard event, use
  19205.  
  19206.   keyDownMask + keyUpMask + autoKeyMask
  19207.  
  19208. For every event except an update, use
  19209.  
  19210.   everyEvent - updateMask
  19211.  
  19212. Note:  It’s recommended that you always use the event mask everyEvent unless
  19213.        there’s a specific reason not to.
  19214.  
  19215. There’s also a global system event mask that controls which event types get posted
  19216. into the event queue. Only event types corresponding to bits set in the system event
  19217. mask are posted; all others are ignored. When the system starts up, the system event
  19218. mask is set to post all except key-up event—that is, it’s initialized to
  19219.  
  19220.   everyEvent - keyUpMask
  19221.  
  19222. Note:  Key-up events are meaningless for most applications. Your application
  19223.        will usually want to ignore them; if not, it can set the system event
  19224.        mask with the Operating System Event Manager procedure SetEventMask.
  19225.  
  19226. æKY mUpMask
  19227. æFp Events.p
  19228. æT CONST
  19229. æD mUpMask = 4;
  19230. æC 
  19231.  
  19232. æKY keyDownMask
  19233. æFp Events.p
  19234. æT CONST
  19235. æD keyDownMask = 8;
  19236. æC 
  19237.  
  19238. æKY keyUpMask
  19239. æFp Events.p
  19240. æT CONST
  19241. æD keyUpMask = 16;
  19242. æC 
  19243.  
  19244. æKY autoKeyMask
  19245. æFp Events.p
  19246. æT CONST
  19247. æD autoKeyMask = 32;
  19248. æC 
  19249.  
  19250. æKY updateMask
  19251. æFp Events.p
  19252. æT CONST
  19253. æD updateMask = 64;
  19254. æC 
  19255.  
  19256. æKY diskMask
  19257. æFp Events.p
  19258. æT CONST
  19259. æD diskMask = 128;
  19260. æC 
  19261.  
  19262. æKY activMask
  19263. æFp Events.p
  19264. æT CONST
  19265. æD activMask = 256;
  19266. æC 
  19267.  
  19268. æKY networkMask
  19269. æFp Events.p
  19270. æT CONST
  19271. æD networkMask = 1024;
  19272. æC 
  19273.  
  19274. æKY driverMask
  19275. æFp Events.p
  19276. æT CONST
  19277. æD driverMask = 2048;
  19278. æC 
  19279.  
  19280. æKY app1Mask
  19281. æFp Events.p
  19282. æT CONST
  19283. æD app1Mask = 4096;
  19284. æC 
  19285.  
  19286. æKY app2Mask
  19287. æFp Events.p
  19288. æT CONST
  19289. æD app2Mask = 8192;
  19290. æC 
  19291.  
  19292. æKY app3Mask
  19293. æFp Events.p
  19294. æT CONST
  19295. æD app3Mask = 16384;
  19296. æC 
  19297.  
  19298. æKY app4Mask
  19299. æFp Events.p
  19300. æT CONST
  19301. æD app4Mask = -32768;
  19302. æC 
  19303.  
  19304. æKY everyEvent
  19305. æFp Events.p
  19306. æT CONST
  19307. æD everyEvent = -1;
  19308. æC 
  19309.  
  19310. æKY activeFlag
  19311. æFp Events.p
  19312. æT CONST
  19313. æD 
  19314. { modifiers }
  19315.  
  19316. activeFlag = 1; {bit 0 of modifiers for activate event}
  19317. æC 
  19318. »Modifier Flags
  19319.  
  19320. As mentioned above, the modifiers field of an event record contains further information
  19321. about activate events and the state of the modifier keys and mouse button at the time
  19322. the event was posted (see Figure 7). You might look at this field to find out, for
  19323. instance, whether the Command key was down when a mouse-down event was posted (which
  19324. in many applications affects the way objects are selected) or when a key-down event
  19325. was posted (which could mean the user is choosing a menu item by typing its keyboard
  19326. equivalent).
  19327.  
  19328. •••Refer to Figure 7.•••
  19329.  
  19330. Figure 7–Modifier Flags
  19331.  
  19332. The following predefined constants are useful as masks for reading the flags in the
  19333. modifiers field:
  19334.  
  19335. CONST  activeFlag = 1;     {set if window being activated}
  19336.        btnState   = 128;   {set if mouse button up}
  19337.        cmdKey     = 256;   {set if Command key down}
  19338.        shiftKey   = 512;   {set if Shift key down}
  19339.        alphaLock  = 1024;  {set if Caps Lock key down}
  19340.        optionKey  = 2048;  {set if Option key down}
  19341.        controlKey = 4096;  {set if Control key down}
  19342.  
  19343. The activeFlag bit gives further information about activate events; it’s set if the
  19344. window pointed to by the event message is being activated, or 0 if the window is
  19345. being deactivated. The remaining bits indicate the state of the mouse button and
  19346. modifier keys. Notice that the btnState bit is set if the mouse button is up, whereas
  19347. the bits for the four modifier keys are set if their corresponding keys are down.
  19348.  
  19349. æKY btnState
  19350. æFp Events.p
  19351. æT CONST
  19352. æD btnState = 128; {Bit 7 of low byte is mouse button state}
  19353. æC 
  19354.  
  19355. æKY cmdKey
  19356. æFp Events.p
  19357. æT CONST
  19358. æD cmdKey = 256; {Bit 0}
  19359. æC 
  19360.  
  19361. æKY shiftKey
  19362. æFp Events.p
  19363. æT CONST
  19364. æD shiftKey = 512; {Bit 1}
  19365. æC 
  19366.  
  19367. æKY alphaLock
  19368. æFp Events.p
  19369. æT CONST
  19370. æD alphaLock = 1024; {Bit 2 }
  19371. æC 
  19372.  
  19373. æKY optionKey
  19374. æFp Events.p
  19375. æT CONST
  19376. æD optionKey = 2048; {Bit 3 of high byte}
  19377. æC 
  19378.  
  19379. æKY controlKey
  19380. æFp Events.p
  19381. æT CONST
  19382. æD controlKey = 4096;
  19383. æC 
  19384.  
  19385. æKY EventRecord
  19386. æFp Events.p
  19387. æT RECORD
  19388. æD EventRecord = RECORD
  19389.     what: INTEGER;
  19390.     message: LONGINT;
  19391.     when: LONGINT;
  19392.     where: Point;
  19393.     modifiers: INTEGER;
  19394.     END;
  19395. æC 
  19396. _______________________________________________________________________________
  19397.  
  19398. »EVENT RECORDS
  19399. _______________________________________________________________________________
  19400.  
  19401. Every event is represented internally by an event record containing all pertinent
  19402. information about that event. The event record includes the following information:
  19403.  
  19404.   •  the type of event
  19405.   •  the time the event was posted (in ticks since system startup)
  19406.   •  the location of the mouse at the time the event was posted (in global
  19407.      coordinates)
  19408.   •  the state of the mouse button and modifier keys at the time the event
  19409.      was posted
  19410.   •  any additional information required for a particular type of event, such
  19411.      as which key the user pressed or which window is being activated
  19412.  
  19413. Every event has an event record containing this information—even null events.
  19414.  
  19415. Event records are defined as follows:
  19416.  
  19417. TYPE  EventRecord = RECORD
  19418.                       what:       INTEGER;  {event code}
  19419.                       message:    LONGINT;  {event message}
  19420.                       when:       LONGINT;  {ticks since startup}
  19421.                       where:      Point;    {mouse location}
  19422.                       modifiers:  INTEGER   {modifier flags}
  19423.                     END;
  19424.  
  19425. The when field contains the number of ticks since the system last started up, and the
  19426. where field gives the location of the mouse, in global coordinates, at the time the
  19427. event was posted. The other three fields are described below.
  19428.  
  19429. _______________________________________________________________________________
  19430.  
  19431. »Event Code
  19432.  
  19433. The what field of an event record contains an event code identifying the type of the
  19434. event. The event codes are available as predefined constants:
  19435.  
  19436. CONST  nullEvent   =  0;    {null}
  19437.        mouseDown   =  1;    {mouse-down}
  19438.        mouseUp     =  2;    {mouse-up}
  19439.        keyDown     =  3;    {key-down}
  19440.        keyUp       =  4;    {key-up}
  19441.        autoKey     =  5;    {auto-key}
  19442.        updateEvt   =  6;    {update}
  19443.        diskEvt     =  7;    {disk-inserted}
  19444.        activateEvt =  8;    {activate}
  19445.        networkEvt  = 10;    {network}
  19446.        driverEvt   = 11;    {device driver}
  19447.        app1Evt     = 12;    {application-defined}
  19448.        app2Evt     = 13;    {application-defined}
  19449.        app3Evt     = 14;    {application-defined}
  19450.        app4Evt     = 15;    {application-defined}
  19451.  
  19452. _______________________________________________________________________________
  19453.  
  19454. »Event Message
  19455.  
  19456. The message field of an event record contains the event message, which conveys additional
  19457. important information about the event. The nature of this information depends on the
  19458. event type, as summarized in the following table and described below.
  19459.  
  19460.   Event type             Event message
  19461.  
  19462.   Keyboard               Character code, key code, and ADB address field
  19463.   Activate, update       Pointer to window
  19464.   Disk-inserted          Drive number in low-order word, File Manager
  19465.                          result code in high-order word
  19466.   Mouse-down,            Undefined
  19467.   mouse-up, null
  19468.   Network                Handle to parameter block
  19469.   Device driver          See chapter describing driver
  19470.   Application-defined    Whatever you wish
  19471.  
  19472. For keyboard events, the low-order byte of the low-order word of the event message
  19473. contains the ASCII character code generated by the key or combination of keys that
  19474. was pressed or released; usually this is all you’ll need.  However, as described in
  19475. the Apple Desktop Bus chapter, the Macintosh II and SE can be connected to multiple
  19476. keyboards.  To identify the origin of keyboard events, the keyboard event message
  19477. contains a new ADB address field.  It now has the structure shown in Figure 2.
  19478.  
  19479. Warning:  The high byte of the event message for keyboard events is reserved
  19480.           for future use, and is not presently guaranteed to be zero.
  19481.  
  19482. The event message for non-keyboard events remains the same as described above.
  19483.  
  19484. •••Refer to Figure 2.•••
  19485.  
  19486. Figure 2–Event Message for Keyboard Events
  19487.  
  19488. The key code in the event message for a keyboard event represents the character key
  19489. that was pressed or released; this value is always the same for any given character
  19490. key, regardless of the modifier keys pressed along with it. Key codes are useful in
  19491. special cases—in a music generator, for example—where you want to treat the keyboard
  19492. as a set of keys unrelated to characters. Figure 3 gives the key codes for all the
  19493. keys on the keyboard and keypad. (Key codes are shown for modifier keys here because
  19494. they’re meaningful in other contexts, as explained later.) Both the U.S. and international
  19495. keyboards are shown; in some cases the codes are quite different (for example, space
  19496. and Enter are reversed).
  19497.  
  19498. Three keyboards are now available as standard equipment with Macintosh computers sold
  19499. in the U.S.  They are
  19500.  
  19501.   •  The Macintosh Plus Keyboard, which includes cursor control keys and an
  19502.      integral keypad.  Its layout and key coding is shown in Figure 4.
  19503.   •  The Macintosh II Keyboard, also shipped with the Macintosh SE, which
  19504.      adds Esc (Escape) and Control keys and is connected to the Apple Desktop
  19505.      Bus.  Its layout and key coding is shown in Figure 5.
  19506.   •  The Apple Extended Keyboard,  which the user may connect to the Apple
  19507.      Desktop Bus of any Macintosh II or Macintosh SE computer.  Its layout
  19508.      and key coding is shown in Figure 6.
  19509.  
  19510. These figures show the virtual key codes for each key; they are the key codes that
  19511. actually appear in keyboard events.  In the case of the Macintosh II and Apple Extended
  19512. Keyboards, however, the hardware produces raw key codes, which may be different.  Raw
  19513. key codes are translated to virtual key codes by the
  19514. 'KMAP' resource in the System Folder.  By modifying the 'KMAP' resource you can
  19515. change the key codes for any keys.  Similarly, you can change the ASCII codes corresponding
  19516. to specific key codes by modifying the 'KCHR' resource in the System Folder.  The
  19517. 'KMAP' and 'KCHR' resources are described in the Resource Manager chapter.
  19518.  
  19519. With both the Macintosh II and the Apple Extended keyboards, the standard 'KMAP'
  19520. resource supplied in the system folder reassigns the following raw key codes to
  19521. different virtual key codes:
  19522.  
  19523.   Key           Raw key code    Virtual key code
  19524.  
  19525.   Control           36                3B
  19526.   Left cursor       3B                7B
  19527.   Right cursor      3C                7C
  19528.   Down cursor       3D                7D
  19529.   Up cursor         3E                7E
  19530.  
  19531. The standard 'KMAP' resource leaves all other raw key codes and virtual key codes the
  19532. same.
  19533.  
  19534. With the Apple Extended Keyboard, the virtual key codes for three more keys may be
  19535. easily reassigned, as described above under “Reassigning Right Key Codes”.
  19536.  
  19537. The following predefined constants are available to help you access the character
  19538. code and key code:
  19539.  
  19540. CONST  charCodeMask = $000000FF;    {character code}
  19541.        keyCodeMask  = $0000FF00;    {key code}
  19542.  
  19543. •••Refer to Figure 3.•••
  19544.  
  19545. Figure 3–Key Codes
  19546.  
  19547. •••Refer to Figure 4.•••
  19548.  
  19549. Figure 4–Macintosh Plus Keyboard
  19550.  
  19551. •••Refer to Figure 5.•••
  19552.  
  19553. Figure 5–Macintosh II Keyboard
  19554.  
  19555. •••Refer to Figure 6.•••
  19556.  
  19557. Figure 6–Apple Extended Keyboard
  19558.  
  19559. Note:  You can use the Toolbox Utility function BitAnd with these constants;
  19560.        for instance, to access the character code, use
  19561.  
  19562.          charCode := BitAnd(my Event.message,charCodeMask)
  19563. _______________________________________________________________________________
  19564.  
  19565. THE TOOLBOX EVENT MANAGER                                           
  19566. _______________________________________________________________________________
  19567.  
  19568. For activate and update events, the event message is a pointer to the window affected.
  19569. (If the event is an activate event, additional important information about the event
  19570. can be found in the modifiers field of the event record, as described below.)
  19571.  
  19572. For disk-inserted events, the low-order word of the event message contains the drive
  19573. number of the disk drive into which the disk was inserted:  1 for the Macintosh’s
  19574. built-in drive, and 2 for the external drive, if any. Numbers greater than 2 denote
  19575. additional disk drives connected to the Macintosh. By the time your application
  19576. receives a disk-inserted event, the system will already have attempted to mount the
  19577. volume on the disk by calling the File Manager function MountVol; the high-order word
  19578. of the event message will contain the result code returned by MountVol.
  19579.  
  19580. For mouse-down, mouse-up, and null events, the event message is undefined and should
  19581. be ignored. The event message for a network event contains a handle to a parameter
  19582. block, as described in the AppleTalk Manager chapter. For device driver events, the
  19583. contents of the event message depend on the situation under which the event was
  19584. generated; the chapters describing those situations will give the details. Finally,
  19585. you can use the event message however you wish for application-defined event types.
  19586.  
  19587. _______________________________________________________________________________
  19588.  
  19589. »Modifier Flags
  19590.  
  19591. As mentioned above, the modifiers field of an event record contains further information
  19592. about activate events and the state of the modifier keys and mouse button at the time
  19593. the event was posted (see Figure 7). You might look at this field to find out, for
  19594. instance, whether the Command key was down when a mouse-down event was posted (which
  19595. in many applications affects the way objects are selected) or when a key-down event
  19596. was posted (which could mean the user is choosing a menu item by typing its keyboard
  19597. equivalent).
  19598.  
  19599. •••Refer to Figure 7.•••
  19600.  
  19601. Figure 7–Modifier Flags
  19602.  
  19603. The following predefined constants are useful as masks for reading the flags in the
  19604. modifiers field:
  19605.  
  19606. CONST  activeFlag = 1;     {set if window being activated}
  19607.        btnState   = 128;   {set if mouse button up}
  19608.        cmdKey     = 256;   {set if Command key down}
  19609.        shiftKey   = 512;   {set if Shift key down}
  19610.        alphaLock  = 1024;  {set if Caps Lock key down}
  19611.        optionKey  = 2048;  {set if Option key down}
  19612.        controlKey = 4096;  {set if Control key down}
  19613.  
  19614. The activeFlag bit gives further information about activate events; it’s set if the
  19615. window pointed to by the event message is being activated, or 0 if the window is
  19616. being deactivated. The remaining bits indicate the state of the mouse button and
  19617. modifier keys. Notice that the btnState bit is set if the mouse button is up, whereas
  19618. the bits for the four modifier keys are set if their corresponding keys are down.
  19619.  
  19620. æKY KeyMap
  19621. æFp Events.p
  19622. æT RECORD
  19623. æD KeyMap = PACKED ARRAY [0..127] OF BOOLEAN;
  19624. æC 
  19625.  
  19626. æKY GetNextEvent
  19627. æFp Events.p
  19628. æT FUNCTION
  19629. æTN A970
  19630. æD FUNCTION GetNextEvent(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  19631.     INLINE $A970;
  19632. æDT myVariable := GetNextEvent(eventMask,theEvent);
  19633. æMM
  19634. æRT 3, 5, 85, 194, 205 
  19635. æRI I-257, N3-1, N5-1, N85, P-30, 32, 34, 39, 40, 97, 108, 173
  19636. æC 
  19637. GetNextEvent returns the next available event of a specified type or types and, if
  19638. the event is in the event queue, removes it from the queue. The event is returned in
  19639. the parameter theEvent. The eventMask parameter specifies which event types are of
  19640. interest. GetNextEvent returns the next available event of any type designated by the
  19641. mask, subject to the priority rules discussed above under “Priority of Events”. If no
  19642. event of any of the designated types is available, GetNextEvent returns a null event.
  19643.  
  19644. Note:  Events in the queue that aren’t designated in the mask are kept in
  19645.        the queue; if you want to remove them, you can do so by calling the
  19646.        Operating System Event Manager procedure FlushEvents.
  19647.  
  19648. Before reporting an event to your application, GetNextEvent first calls the Desk
  19649. Manager function SystemEvent to see whether the system wants to intercept and respond
  19650. to the event. If so, or if the event being reported is a null event, GetNextEvent
  19651. returns a function result of FALSE; a function result of TRUE means that your application
  19652. should handle the event itself. The Desk Manager intercepts the following events:
  19653.  
  19654.   •  activate and update events directed to a desk accessory
  19655.   •  mouse-up and keyboard events, if the currently active window belongs to
  19656.      a desk accessory
  19657.  
  19658. Note:  In each case, the event is intercepted by the Desk Manager only if
  19659.        the desk accessory can handle that type of event; however, as a rule
  19660.        all desk accessories should be set up to handle activate, update, and
  19661.        keyboard events and should not handle mouse-up events.
  19662.  
  19663. The Desk Manager also intercepts disk-inserted events:  It attempts to mount the
  19664. volume on the disk by calling the File Manager function MountVol. GetNextEvent will
  19665. always return TRUE in this case, though, so that your application can take any further
  19666. appropriate action after examining the result code returned by MountVol in the event
  19667. message. (See the Desk Manager and File Manager chapters.) GetNextEvent returns TRUE
  19668. for all other non-null events
  19669. (including all mouse-down events, regardless of which window is active), leaving them
  19670. for your application to handle.
  19671.  
  19672. GetNextEvent also makes the following processing happen, invisible to your program:
  19673.  
  19674.   •  If the “alarm” is set and the current time is the alarm time, the alarm
  19675.      goes off (a beep followed by blinking the apple symbol in the menu bar).
  19676.      The user can set the alarm with the Alarm Clock desk accessory.
  19677.   •  If the user holds down the Command and Shift keys while pressing a
  19678.      numeric key that has a special effect, that effect occurs. The standard
  19679.      such keys are 1 and 2 for ejecting the disk in the internal or external
  19680.      drive, and 3 and 4 for writing a snapshot of the screen to a MacPaint
  19681.      document or to the printer.
  19682.  
  19683. Note:  Advanced programmers can implement their own code to be executed in
  19684.        response to Command-Shift-number combinations (except for Command-
  19685.        Shift-1 and 2, which can’t be changed). The code corresponding to a
  19686.        particular number must be a routine having no parameters, stored in
  19687.        a resource whose type is 'FKEY' and whose ID is the number. The
  19688.        system resource file contains code for the numbers 3 and 4.
  19689.  
  19690. Assembly-language note:  You can disable GetNextEvent’s processing of Command-
  19691.                          Shift-number combinations by setting the global
  19692.                          variable ScrDmpEnb (a byte) to 0.
  19693.  
  19694. æKY WaitNextEvent
  19695. æFp Events.p
  19696. æT FUNCTION
  19697. æTN A860
  19698. æD FUNCTION WaitNextEvent(mask: INTEGER;VAR event: EventRecord;sleep: LONGINT;
  19699.     mouseRgn: RgnHandle): BOOLEAN;
  19700.     INLINE $A860;
  19701. æDT myVariable := WaitNextEvent(mask,event,sleep,mouseRgn);
  19702. æRT 158, 177, 180, 194, 205
  19703. æRI N158-1
  19704. æC 
  19705.  
  19706. æKY EventAvail
  19707. æFp Events.p
  19708. æT FUNCTION
  19709. æTN A971
  19710. æD FUNCTION EventAvail(eventMask: INTEGER;VAR theEvent: EventRecord): BOOLEAN;
  19711.     INLINE $A971;
  19712. æDT myVariable := EventAvail(eventMask,theEvent);
  19713. æMM
  19714. æRT 194
  19715. æRI I-259
  19716. æC 
  19717. EventAvail works exactly the same as GetNextEvent except that if the event is in the
  19718. event queue, it’s left there.
  19719.  
  19720. Note:  An event returned by EventAvail will not be accessible later if in
  19721.        the meantime the queue becomes full and the event is discarded from
  19722.        it; since the events discarded are always the oldest ones in the queue,
  19723.        however, this will happen only in an unusually busy environment.
  19724.  
  19725. æKY GetMouse
  19726. æFp Events.p
  19727. æT PROCEDURE
  19728. æTN A972
  19729. æD PROCEDURE GetMouse(VAR mouseLoc: Point);
  19730.     INLINE $A972;
  19731. æDT GetMouse(mouseLoc);
  19732. æMM
  19733. æRI I-259
  19734. æC  
  19735. GetMouse returns the current mouse location in the mouseLoc parameter. The location
  19736. is given in the local coordinate system of the current grafPort (which might be, for
  19737. example, the currently active window). Notice that this differs from the mouse location
  19738. stored in the where field of an event record; that location is always in global
  19739. coordinates.
  19740.  
  19741. æKY Button
  19742. æFp Events.p
  19743. æT FUNCTION
  19744. æTN A974
  19745. æD FUNCTION Button: BOOLEAN;
  19746.     INLINE $A974;
  19747. æDT myVariable := Button(paramList);
  19748. æMM
  19749. æRI I-259
  19750. æC 
  19751. The Button function returns TRUE if the mouse button is currently down, and FALSE if
  19752. it isn’t.
  19753.  
  19754. æKY StillDown
  19755. æFp Events.p
  19756. æT FUNCTION
  19757. æTN A973
  19758. æD FUNCTION StillDown: BOOLEAN;
  19759.     INLINE $A973;
  19760. æDT myVariable := StillDown(paramList);
  19761. æMM
  19762. æRT 194
  19763. æRI I-259
  19764. æC 
  19765. Usually called after a mouse-down event, StillDown tests whether the mouse button is
  19766. still down. It returns TRUE if the button is currently down and there are no more
  19767. mouse events pending in the event queue. This is a true test of whether the button is
  19768. still down from the original press—unlike Button (above), which returns TRUE whenever
  19769. the button is currently down, even if it has been released and pressed again since
  19770. the original mouse-down event.
  19771.  
  19772. æKY WaitMouseUp
  19773. æFp Events.p
  19774. æT FUNCTION
  19775. æTN A977
  19776. æD FUNCTION WaitMouseUp: BOOLEAN;
  19777.     INLINE $A977;
  19778. æDT myVariable := WaitMouseUp(paramList);
  19779. æMM
  19780. æRT 194
  19781. æRI I-259
  19782. æC 
  19783. WaitMouseUp works exactly the same as StillDown (above), except that if the button is
  19784. not still down from the original press, WaitMouseUp removes the preceding mouse-up
  19785. event before returning FALSE. If, for instance, your application attaches some special
  19786. significance both to mouse double-clicks and to mouse-up events, this function would
  19787. allow your application to recognize a double-click without being confused by the
  19788. intervening mouse-up.
  19789.  
  19790. æKY GetKeys
  19791. æFp Events.p
  19792. æT PROCEDURE
  19793. æTN A976
  19794. æD PROCEDURE GetKeys(VAR theKeys: KeyMap);
  19795.     INLINE $A976;
  19796. { PROCEDUREGetKeys (VAR theKeys: KeyMap);
  19797.  
  19798.     GetKeys reads the current state of the keyboard (and keypad, if any)
  19799. and returns it in the form of a keyMap:
  19800.  
  19801.     TYPE KeyMap = PACKED ARRAY [Ø..127] OF BOOLEAN;
  19802.  
  19803.     Each key on the keyboard or keypad corresponds to an element in the
  19804. keyMap. The index into the keyMap for a particular key is the same as
  19805. the key code for that key. (The key codes are shown in Figure 3
  19806. above.)  The keyMap element is TRUE if the corresponding key is down
  19807. and FALSE if it isn't. The maximum number of keys that can be down 
  19808. simultaneously is two character keys plus any combination of the four
  19809. modifier keys.
  19810.  }
  19811. æDT GetKeys(theKeys);
  19812. æMM
  19813. æRI I-259
  19814. æC 
  19815. GetKeys reads the current state of the keyboard (and keypad, if any) and returns it
  19816. in the form of a keyMap:
  19817.  
  19818. TYPE KeyMap = PACKED ARRAY[0..127] OF BOOLEAN;
  19819.  
  19820. Each key on the keyboard or keypad corresponds to an element in the keyMap. The index
  19821. into the keyMap for a particular key is the same as the key code for that key. (The
  19822. key codes are shown in Figure 3 above.) The keyMap element is TRUE if the corresponding
  19823. key is down and FALSE if it isn’t. The maximum number of keys that can be down simultaneously
  19824. is two character keys plus any combination of the four modifier keys.
  19825.  
  19826. æKY TickCount
  19827. æFp Events.p
  19828. æT FUNCTION
  19829. æTN A975
  19830. æD FUNCTION TickCount: LONGINT;
  19831.     INLINE $A975;
  19832. æDT myVariable := TickCount(paramList);
  19833. æMM
  19834. æRI I-260
  19835. æC 
  19836. TickCount returns the current number of ticks (sixtieths of a second) since the
  19837. system last started up.
  19838.  
  19839. Warning:  Don’t rely on the tick count being exact; it will usually be
  19840.           accurate to within one tick, but may be off by more than that. The
  19841.           tick count is incremented during the vertical retrace interrupt,
  19842.           but it’s possible for this interrupt to be disabled. Furthermore,
  19843.           don’t rely on the tick count being incremented to a certain value,
  19844.           such as testing whether it has become equal to its old value plus 1;
  19845.           check instead for “greater than or equal to” (since an interrupt
  19846.           task may keep control for more than one tick).
  19847.  
  19848. Assembly-language note:  The value returned by this function is also contained
  19849.                          in the global variable Ticks.
  19850.  
  19851. æKY GetDblTime
  19852. æFp Events.p
  19853. æT FUNCTION
  19854. æD FUNCTION GetDblTime: LONGINT;
  19855.     INLINE $2EB8,$02F0;
  19856. æDT myVariable := GetDblTime(paramList);
  19857. æRI I-260
  19858. æC 
  19859. [Not in ROM]
  19860.  
  19861. GetDblTime returns the suggested maximum difference (in ticks) that should exist
  19862. between the times of a mouse-up event and a mouse-down event for those two mouse
  19863. clicks to be considered a double-click. The user can adjust this value by means of
  19864. the Control Panel desk accessory.
  19865.  
  19866. Assembly-language note:  This value is available to assembly-language
  19867.                          programmers in the global variable DoubleTime.
  19868.  
  19869. æKY GetCaretTime
  19870. æFp Events.p
  19871. æT FUNCTION
  19872. æD FUNCTION GetCaretTime: LONGINT;
  19873.     INLINE $2EB8,$02F4;
  19874. æDT myVariable := GetCaretTime(paramList);
  19875. æRI I-260
  19876. æC 
  19877. [Not in ROM]
  19878.  
  19879. GetCaretTime returns the time (in ticks) between blinks of the “caret” (usually a
  19880. vertical bar) marking the insertion point in editable text. If you aren’t using
  19881. TextEdit, you’ll need to cause the caret to blink yourself; on every pass through
  19882. your program’s main event loop, you should check this value against the elapsed time
  19883. since the last blink of the caret. The user can adjust this value by means of the
  19884. Control Panel desk accessory.
  19885.  
  19886. Assembly-language note:  This value is available to assembly-language
  19887.                          programmers in the global variable CaretTime.
  19888.  
  19889.  
  19890. æKY Files.p
  19891. æKL AddDrive
  19892. Allocate
  19893. AllocContig
  19894. CatMove
  19895. CloseWD
  19896. Create
  19897. DirCreate
  19898. Eject
  19899. FInitQueue
  19900. FlushVol
  19901. FSClose
  19902. FSDelete
  19903. FSOpen
  19904. FSpCatMove
  19905. FSpCreate
  19906. FSpCreateResFile
  19907. FSpDelete
  19908. FSpDirCreate
  19909. FSpGetFInfo
  19910. FSpOpenDF
  19911. FSpOpenResFile
  19912. FSpOpenRF
  19913. FSpRename
  19914. FSpRstFLock
  19915. FSpSetFInfo
  19916. FSpSetFLock
  19917. FSRead
  19918. FSWrite
  19919. GetDrvQHdr
  19920. GetEOF
  19921. GetFInfo
  19922. GetFPos
  19923. GetFSQHdr
  19924. GetVCBQHdr
  19925. GetVInfo
  19926. GetVol
  19927. GetVRefNum
  19928. GetWDInfo
  19929. HCreate
  19930. HDelete
  19931. HGetFInfo
  19932. HGetVol
  19933. HOpen
  19934. HOpenRF
  19935. HRename
  19936. HRstFLock
  19937. HSetFInfo
  19938. HSetFLock
  19939. HSetVol
  19940. MakeFSSpec
  19941. OpenRF
  19942. OpenWD
  19943. PBAllocate
  19944. PBAllocContig
  19945. PBCatMove
  19946. PBClose
  19947. PBCloseWD
  19948. PBCreate
  19949. PBCreateFileID
  19950. PBDelete
  19951. PBDeleteFileID
  19952. PBDirCreate
  19953. PBDTAddAPPL
  19954. PBDTAddIcon
  19955. PBDTCloseDown
  19956. PBDTDelete
  19957. PBDTFlush
  19958. PBDTGetAPPL
  19959. PBDTGetComment
  19960. PBDTGetIcon
  19961. PBDTGetIconInfo
  19962. PBDTGetInfo
  19963. PBDTGetPath
  19964. PBDTOpenInform
  19965. PBDTRemoveAPPL
  19966. PBDTRemoveComment
  19967. PBDTReset
  19968. PBDTSetComment
  19969. PBEject
  19970. PBExchangeFiles
  19971. PBFlushFile
  19972. PBFlushVol
  19973. PBGetAltAccess
  19974. PBGetCatInfo
  19975. PBGetEOF
  19976. PBGetFCBInfo
  19977. PBGetFInfo
  19978. PBGetFPos
  19979. PBGetVInfo
  19980. PBGetVol
  19981. PBGetWDInfo
  19982. PBHCopyFile
  19983. PBHCreate
  19984. PBHDelete
  19985. PBHGetDirAccess
  19986. PBHGetFInfo
  19987. PBHGetLogInInfo
  19988. PBHGetVInfo
  19989. PBHGetVol
  19990. PBHGetVolParms
  19991. PBHMapID
  19992. PBHMapName
  19993. PBHMoveRename
  19994. PBHOpen
  19995. PBHOpenDeny
  19996. PBHOpenDF
  19997. PBHOpenRF
  19998. PBHOpenRFDeny
  19999. PBHRename
  20000. PBHRstFLock
  20001. PBHSetDirAccess
  20002. PBHSetFInfo
  20003. PBHSetFLock
  20004. PBHSetVol
  20005. PBLockRange
  20006. PBMakeFSSpec
  20007. PBMountVol
  20008. PBOffLine
  20009. PBOpen
  20010. PBOpenDF
  20011. PBOpenRF
  20012. PBOpenWD
  20013. PBRead
  20014. PBRename
  20015. PBResolveFileID
  20016. PBRstFLock
  20017. PBSetAltAccess
  20018. PBSetCatInfo
  20019. PBSetEOF
  20020. PBSetFInfo
  20021. PBSetFLock
  20022. PBSetFPos
  20023. PBSetFVers
  20024. PBSetVInfo
  20025. PBSetVol
  20026. PBUnlockRange
  20027. PBUnmountVol
  20028. PBWrite
  20029. Rename
  20030. RstFLock
  20031. SetEOF
  20032. SetFInfo
  20033. SetFLock
  20034. SetFPos
  20035. SetVol
  20036. UnmountVol
  20037.  
  20038. alphaStage
  20039. betaStage
  20040. CatPositionRec
  20041. CInfoPBPtr
  20042. CInfoPBRec
  20043. CInfoType
  20044. CMovePBPtr
  20045. CMovePBRec
  20046. developStage
  20047. DInfo
  20048. dirInfo
  20049. DTPBPtr
  20050. DTPBRec
  20051. DXInfo
  20052. FCBPBPtr
  20053. FCBPBRec
  20054. fDesktop
  20055. fDisk
  20056. fHasBundle
  20057. finalStage
  20058. fInvisible
  20059. fOnDesk
  20060. fsAtMark
  20061. fsCurPerm
  20062. fsFromLEOF
  20063. fsFromMark
  20064. fsFromStart
  20065. fsRdPerm
  20066. fsRdWrPerm
  20067. fsRdWrShPerm
  20068. fsRtDirID
  20069. fsRtParID
  20070. fsSBDrBkDat
  20071. fsSBDrCrDat
  20072. fsSBDrFndrInfo
  20073. fsSBDrMdDat
  20074. fsSBDrNmFls
  20075. fsSBDrParID
  20076. fsSBDrUsrWds
  20077. fsSBFlAttrib
  20078. fsSBFlBkDat
  20079. fsSBFlCrDat
  20080. fsSBFlFndrInfo
  20081. fsSBFlLgLen
  20082. fsSBFlMdDat
  20083. fsSBFlParID
  20084. fsSBFlPyLen
  20085. fsSBFlRLgLen
  20086. fsSBFlRPyLen
  20087. fsSBFlXFndrInfo
  20088. fsSBFullName
  20089. fsSBNegate
  20090. fsSBPartialName
  20091. FSSpec
  20092. FSSpecArray
  20093. FSSpecArrayHandle
  20094. FSSpecArrayPtr
  20095. fsWrPerm
  20096. fTrash
  20097. FXInfo
  20098. hFileInfo
  20099. HParamBlockRec
  20100. HParmBlkPtr
  20101. ioDirFlg
  20102. ioDirMask
  20103. NumVersion
  20104. rdVerify
  20105. VersRec
  20106. VersRecHndl
  20107. VersRecPtr
  20108. WDPBPtr
  20109. WDPBRec
  20110.  
  20111. æKY fsAtMark
  20112. æFp Files.p
  20113. æT CONST
  20114. æD 
  20115. { Finder Constants }
  20116.  
  20117. fsAtMark = 0;
  20118. æC If you specify fsAtMark, ioPosOffset is ignored and the operation begins wherever the
  20119. mark is currently positioned. If you choose to set the mark
  20120. (relative to either the beginning of the file, the logical end-of-file, or the current
  20121. mark), ioPosOffset must specify the byte offset from the chosen point
  20122. (either positive or negative) where the operation should begin.
  20123.  
  20124. Note:  Advanced programmers:  Bit 7 of ioPosMode is the newline flag; it’s
  20125.        set if read operations should terminate at a newline character. The
  20126.        ASCII code of the newline character is specified in the high-order
  20127.        byte of ioPosMode. If the newline flag is set, the data will be read
  20128.        one byte at a time until the newline character is encountered,
  20129.        ioReqCount bytes have been read, or the end-of-file is reached. If
  20130.        the newline flag is clear, the data will be read one byte at a time
  20131.        until ioReqCount bytes have been read or the end-of-file is reached.
  20132.  
  20133. æKY fOnDesk
  20134. æFp Files.p
  20135. æT CONST
  20136. æD fOnDesk = 1;
  20137. æC 
  20138.  
  20139. æKY fsCurPerm
  20140. æFp Files.p
  20141. æT CONST
  20142. æD fsCurPerm = 0;
  20143. æC 
  20144. This request is compared with the open permission of the file. If the open permission
  20145. doesn’t allow I/O as requested, a result code indicating the error is returned.
  20146.  
  20147. Warning:  To ensure data integrity be sure to lock the portion of the
  20148.           file you’ll be using if you specify shared write permission.
  20149.  
  20150. æKY fHasBundle
  20151. æFp Files.p
  20152. æT CONST
  20153. æD fHasBundle = 8192;
  20154. æC 
  20155.  
  20156. æKY fsRdPerm
  20157. æFp Files.p
  20158. æT CONST
  20159. æD fsRdPerm = 1;
  20160. æC 
  20161.  
  20162. æKY fInvisible
  20163. æFp Files.p
  20164. æT CONST
  20165. æD fInvisible = 16384;
  20166. æC 
  20167.  
  20168. æKY fTrash
  20169. æFp Files.p
  20170. æT CONST
  20171. æD fTrash = -3;
  20172. æC 
  20173.  
  20174. æKY fsWrPerm
  20175. æFp Files.p
  20176. æT CONST
  20177. æD fsWrPerm = 2;
  20178. æC 
  20179.  
  20180. æKY fDesktop
  20181. æFp Files.p
  20182. æT CONST
  20183. æD fDesktop = -2;
  20184. æC 
  20185.  
  20186. æKY fsRdWrPerm
  20187. æFp Files.p
  20188. æT CONST
  20189. æD fsRdWrPerm = 3;
  20190. æC 
  20191.  
  20192. æKY fDisk
  20193. æFp Files.p
  20194. æT CONST
  20195. æD fDisk = 0;
  20196. æC 
  20197.  
  20198. æKY fsRdWrShPerm
  20199. æFp Files.p
  20200. æT CONST
  20201. æD fsRdWrShPerm = 4;
  20202. æC 
  20203.  
  20204. æKY fsFromStart
  20205. æFp Files.p
  20206. æT CONST
  20207. æD fsFromStart = 1;
  20208. æC 
  20209.  
  20210. æKY fsFromLEOF
  20211. æFp Files.p
  20212. æT CONST
  20213. æD fsFromLEOF = 2;
  20214. æC 
  20215.  
  20216. æKY fsFromMark
  20217. æFp Files.p
  20218. æT CONST
  20219. æD fsFromMark = 3;
  20220. æC 
  20221.  
  20222. æKY rdVerify
  20223. æFp Files.p
  20224. æT CONST
  20225. æD rdVerify = 64;
  20226. æC 
  20227. To have the File Manager verify that all data written to a volume exactly matches the
  20228. data in memory, make a Read call right after the Write call. The parameters for a
  20229. read-verify operation are the same as for a standard Read call, except that the
  20230. following constant must be added to the positioning mode:
  20231.  
  20232. CONST  rdVerify = 64;    {read-verify mode}
  20233.  
  20234. The result code ioErr is returned if any of the data doesn’t match.
  20235.  
  20236. æKY ioDirFlg
  20237. æFp Files.p
  20238. æT CONST
  20239. æD ioDirFlg = 3;
  20240. æC 
  20241.  
  20242. æKY ioDirMask
  20243. æFp Files.p
  20244. æT CONST
  20245. æD ioDirMask = $10;
  20246. æC 
  20247.  
  20248. æKY fsRtParID
  20249. æFp Files.p
  20250. æT CONST
  20251. æD fsRtParID = 1;
  20252. æC 
  20253.  
  20254. æKY fsRtDirID
  20255. æFp Files.p
  20256. æT CONST
  20257. æD fsRtDirID = 2;
  20258. æC 
  20259.  
  20260. æKY fsSBNegate
  20261. æFp Files.p
  20262. æT CONST
  20263. æD fsSBNegate = 16384;
  20264. æC 
  20265.  
  20266. æKY fsSBPartialName
  20267. æFp Files.p
  20268. æT CONST
  20269. æD 
  20270. {  masks for SpecBits values  }
  20271.  
  20272. fsSBPartialName = 1;
  20273. æC 
  20274.  
  20275. æKY fsSBFullName
  20276. æFp Files.p
  20277. æT CONST
  20278. æD fsSBFullName = 2;
  20279. æC 
  20280.  
  20281. æKY fsSBFlAttrib
  20282. æFp Files.p
  20283. æT CONST
  20284. æD fsSBFlAttrib = 4;
  20285. æC 
  20286.  
  20287. æKY fsSBFlFndrInfo
  20288. æFp Files.p
  20289. æT CONST
  20290. æD fsSBFlFndrInfo = 8;
  20291. æC 
  20292.  
  20293. æKY fsSBFlLgLen
  20294. æFp Files.p
  20295. æT CONST
  20296. æD fsSBFlLgLen = 32;
  20297. æC 
  20298.  
  20299. æKY fsSBFlPyLen
  20300. æFp Files.p
  20301. æT CONST
  20302. æD fsSBFlPyLen = 64;
  20303. æC 
  20304.  
  20305. æKY fsSBFlRLgLen
  20306. æFp Files.p
  20307. æT CONST
  20308. æD fsSBFlRLgLen = 128;
  20309. æC 
  20310.  
  20311. æKY fsSBFlRPyLen
  20312. æFp Files.p
  20313. æT CONST
  20314. æD fsSBFlRPyLen = 256;
  20315. æC 
  20316.  
  20317. æKY fsSBFlCrDat
  20318. æFp Files.p
  20319. æT CONST
  20320. æD fsSBFlCrDat = 512;
  20321. æC 
  20322.  
  20323. æKY fsSBFlMdDat
  20324. æFp Files.p
  20325. æT CONST
  20326. æD fsSBFlMdDat = 1024;
  20327. æC 
  20328.  
  20329. æKY fsSBFlBkDat
  20330. æFp Files.p
  20331. æT CONST
  20332. æD fsSBFlBkDat = 2048;
  20333. æC 
  20334.  
  20335. æKY fsSBFlXFndrInfo
  20336. æFp Files.p
  20337. æT CONST
  20338. æD fsSBFlXFndrInfo = 4096;
  20339. æC 
  20340.  
  20341. æKY fsSBFlParID
  20342. æFp Files.p
  20343. æT CONST
  20344. æD fsSBFlParID = 8192;
  20345. æC 
  20346.  
  20347. æKY fsSBDrUsrWds
  20348. æFp Files.p
  20349. æT CONST
  20350. æD fsSBDrUsrWds = 8;
  20351. æC 
  20352.  
  20353. æKY fsSBDrNmFls
  20354. æFp Files.p
  20355. æT CONST
  20356. æD fsSBDrNmFls = 16;
  20357. æC 
  20358.  
  20359. æKY fsSBDrCrDat
  20360. æFp Files.p
  20361. æT CONST
  20362. æD fsSBDrCrDat = 512;
  20363. æC 
  20364.  
  20365. æKY fsSBDrMdDat
  20366. æFp Files.p
  20367. æT CONST
  20368. æD fsSBDrMdDat = 1024;
  20369. æC 
  20370.  
  20371. æKY fsSBDrBkDat
  20372. æFp Files.p
  20373. æT CONST
  20374. æD fsSBDrBkDat = 2048;
  20375. æC 
  20376.  
  20377. æKY fsSBDrFndrInfo
  20378. æFp Files.p
  20379. æT CONST
  20380. æD fsSBDrFndrInfo = 4096;
  20381. æC 
  20382.  
  20383. æKY fsSBDrParID
  20384. æFp Files.p
  20385. æT CONST
  20386. æD fsSBDrParID = 8192;
  20387. æC 
  20388.  
  20389. æKY developStage
  20390. æFp Files.p
  20391. æT CONST
  20392. æD 
  20393. { Version Release Stage Codes }
  20394.  
  20395. developStage = $20;
  20396. æC 
  20397.  
  20398. æKY alphaStage
  20399. æFp Files.p
  20400. æT CONST
  20401. æD alphaStage = $40;
  20402. æC 
  20403.  
  20404. æKY betaStage
  20405. æFp Files.p
  20406. æT CONST
  20407. æD betaStage = $60;
  20408. æC 
  20409.  
  20410. æKY finalStage
  20411. æFp Files.p
  20412. æT CONST
  20413. æD finalStage = $80;
  20414. æC 
  20415.  
  20416. æKY CInfoType
  20417. hFileInfo
  20418. dirInfo
  20419. æFp Files.p
  20420. æT TYPE
  20421. æD CInfoType = (hFileInfo,dirInfo);
  20422. æC 
  20423.  
  20424. æKY FXInfo
  20425. æFp Files.p
  20426. æT RECORD
  20427. æD FXInfo = RECORD
  20428.     fdIconID: INTEGER; {Icon ID}
  20429.     fdUnused: ARRAY [1..4] OF INTEGER; {unused but reserved 8 bytes}
  20430.     fdComment: INTEGER; {Comment ID}
  20431.     fdPutAway: LONGINT; {Home Dir ID}
  20432.     END;
  20433. æC 
  20434. On hierarchical volumes, in addition to the FInfo record, the following information
  20435. about files is maintained for the Finder:
  20436.  
  20437. æKY DInfo
  20438. æFp Files.p
  20439. æT RECORD
  20440. æD DInfo = RECORD
  20441.     frRect: Rect; {folder rect}
  20442.     frFlags: INTEGER; {Flags}
  20443.     frLocation: Point; {folder location}
  20444.     frView: INTEGER; {folder view}
  20445.     END;
  20446. æC 
  20447. On hierarchical volumes, the following information about directories is maintained
  20448. for the Finder:
  20449.  
  20450. DInfo = RECORD
  20451.           frRect:      Rect;       {folder's rectangle}
  20452.           frFlags:     INTEGER;    {flags}
  20453.           frLocation:  Point;      {folder's location}
  20454.           frView:      INTEGER;    {folder's view}
  20455.         END;
  20456.  
  20457. DXInfo = RECORD
  20458.            frScroll:     Point;      {scroll position}
  20459.            frOpenChain:  LONGINT;    {directory ID chain of open folders}
  20460.            frUnused:     INTEGER;    {reserved}
  20461.            frComment:    INTEGER;    {comment ID}
  20462.            frPutAway:    LONGINT;    {directory ID}
  20463.          END;
  20464.  
  20465. When a file (or folder) is moved to the desktop on a hierarchical volume, it’s actually
  20466. moved to the root level of the file directory. (This permits all the desktop icons to
  20467. be enumerated by one simple scan of the root.) The fOnDesk bit of fdFlags is set.
  20468. FDPutAway (or frPutAway for directories) contains the directory ID of the folder that
  20469. originally contained the file (or folder); this allows the file (or folder) to be
  20470. returned there from the desktop.
  20471.  
  20472. æKY DXInfo
  20473. æFp Files.p
  20474. æT RECORD
  20475. æD DXInfo = RECORD
  20476.     frScroll: Point; {scroll position}
  20477.     frOpenChain: LONGINT; {DirID chain of open folders}
  20478.     frUnused: INTEGER; {unused but reserved}
  20479.     frComment: INTEGER; {comment}
  20480.     frPutAway: LONGINT; {DirID}
  20481.     END;
  20482. æC 
  20483.  
  20484. æKY CMovePBRec
  20485. CMovePBPtr
  20486. æFp Files.p
  20487. æT RECORD
  20488. æD CMovePBPtr = ^CMovePBRec;
  20489. CMovePBRec = RECORD
  20490.     qLink: QElemPtr;
  20491.     qType: INTEGER;
  20492.     ioTrap: INTEGER;
  20493.     ioCmdAddr: Ptr;
  20494.     ioCompletion: ProcPtr;
  20495.     ioResult: OSErr;
  20496.     ioNamePtr: StringPtr;
  20497.     ioVRefNum: INTEGER;
  20498.     filler1: LONGINT;
  20499.     ioNewName: StringPtr;
  20500.     filler2: LONGINT;
  20501.     ioNewDirID: LONGINT;
  20502.     filler3: ARRAY [1..2] OF LONGINT;
  20503.     ioDirID: LONGINT;
  20504.     END;
  20505. æC 
  20506. »CMovePBRec
  20507.  
  20508. When you call CatMove to move files or directories into a different directory, you’ll
  20509. use the following six additional fields after the standard eight fields in the parameter
  20510. block record CMovePBRec:
  20511.  
  20512.   filler1:     LONGINT;    {not used}
  20513.   ioNewName:   StringPtr;  {name of new directory}
  20514.   filler2:     LONGINT;    {not used}
  20515.   ioNewDirID:  LONGINT;    {directory ID of new directory}
  20516.   filler3:     ARRAY[1..2] OF LONGINT; {not used}
  20517.   ioDirID:     LONGINT);   {directory ID of current directory}
  20518.  
  20519. IONewName and ioNewDirID specify the name and directory ID of the directory to which
  20520. the file or directory is to be moved. IODirID (used in conjuntion with the ioVRefNum
  20521. and ioNamePtr) specifies the current directory ID of the file or directory to be
  20522. moved.
  20523.  
  20524. æKY WDPBRec
  20525. WDPBPtr
  20526. æFp Files.p
  20527. æT RECORD
  20528. æD WDPBPtr = ^WDPBRec;
  20529. WDPBRec = RECORD
  20530.     qLink: QElemPtr;
  20531.     qType: INTEGER;
  20532.     ioTrap: INTEGER;
  20533.     ioCmdAddr: Ptr;
  20534.     ioCompletion: ProcPtr;
  20535.     ioResult: OSErr;
  20536.     ioNamePtr: StringPtr;
  20537.     ioVRefNum: INTEGER;
  20538.     filler1: INTEGER;
  20539.     ioWDIndex: INTEGER;
  20540.     ioWDProcID: LONGINT;
  20541.     ioWDVRefNum: INTEGER;
  20542.     filler2: ARRAY [1..7] OF INTEGER;
  20543.     ioWDDirID: LONGINT;
  20544.     END;
  20545. æC 
  20546. »WDPBRec
  20547.  
  20548. When you call the routines that open, close, and get information about working directories,
  20549. you’ll use the following six additional fields after the standard eight fields in the
  20550. parameter block record WDPBRec:
  20551.  
  20552.   filler1:      INTEGER;    {not used}
  20553.   ioWDIndex:    INTEGER;    {index}
  20554.   ioWDProcID:   LONGINT;    {working directory user identifier}
  20555.   ioWDVRefNum:  INTEGER;    {working directory's volume reference number}
  20556.   filler2:      ARRAY[1..7] OF INTEGER;  {not used}
  20557.   ioWDDirID:    LONGINT);   {working directory's directory ID}
  20558.  
  20559. IOWDIndex can be used with the function PBGetWDInfo to index through the current
  20560. working directories.
  20561.  
  20562. IOWDProcID is an identifier that’s used to distinguish between working directories
  20563. set up by different users; you should use the application’s signature (discussed in
  20564. the Finder Interface chapter) as the ioWDProcID.
  20565.  
  20566. æKY FCBPBRec
  20567. FCBPBPtr
  20568. æFp Files.p
  20569. æT RECORD
  20570. æD FCBPBPtr = ^FCBPBRec;
  20571. FCBPBRec = RECORD
  20572.     qLink: QElemPtr;
  20573.     qType: INTEGER;
  20574.     ioTrap: INTEGER;
  20575.     ioCmdAddr: Ptr;
  20576.     ioCompletion: ProcPtr;
  20577.     ioResult: OSErr;
  20578.     ioNamePtr: StringPtr;
  20579.     ioVRefNum: INTEGER;
  20580.     ioRefNum: INTEGER;
  20581.     filler: INTEGER;
  20582.     ioFCBIndx: INTEGER;
  20583.     filler1: INTEGER;
  20584.     ioFCBFlNm: LONGINT;
  20585.     ioFCBFlags: INTEGER;
  20586.     ioFCBStBlk: INTEGER;
  20587.     ioFCBEOF: LONGINT;
  20588.     ioFCBPLen: LONGINT;
  20589.     ioFCBCrPs: LONGINT;
  20590.     ioFCBVRefNum: INTEGER;
  20591.     ioFCBClpSiz: LONGINT;
  20592.     ioFCBParID: LONGINT;
  20593.     END;
  20594. æC 
  20595.  
  20596. æKY CInfoPBRec
  20597. CInfoPBPtr
  20598. æFp Files.p
  20599. æT RECORD
  20600. æD CInfoPBPtr = ^CInfoPBRec;
  20601. CInfoPBRec = RECORD
  20602.     qLink: QElemPtr;
  20603.     qType: INTEGER;
  20604.     ioTrap: INTEGER;
  20605.     ioCmdAddr: Ptr;
  20606.     ioCompletion: ProcPtr;
  20607.     ioResult: OSErr;
  20608.     ioNamePtr: StringPtr;
  20609.     ioVRefNum: INTEGER;
  20610.     ioFRefNum: INTEGER;
  20611.     ioFVersNum: SignedByte;
  20612.     filler1: SignedByte;
  20613.     ioFDirIndex: INTEGER;
  20614.     ioFlAttrib: SignedByte;
  20615.     filler2: SignedByte;
  20616.     CASE CInfoType OF
  20617.       hFileInfo:
  20618.         (ioFlFndrInfo: FInfo;
  20619.         ioDirID: LONGINT;
  20620.         ioFlStBlk: INTEGER;
  20621.         ioFlLgLen: LONGINT;
  20622.         ioFlPyLen: LONGINT;
  20623.         ioFlRStBlk: INTEGER;
  20624.         ioFlRLgLen: LONGINT;
  20625.         ioFlRPyLen: LONGINT;
  20626.         ioFlCrDat: LONGINT;
  20627.         ioFlMdDat: LONGINT;
  20628.         ioFlBkDat: LONGINT;
  20629.         ioFlXFndrInfo: FXInfo;
  20630.         ioFlParID: LONGINT;
  20631.         ioFlClpSiz: LONGINT);
  20632.       dirInfo:
  20633.         (ioDrUsrWds: DInfo;
  20634.         ioDrDirID: LONGINT;
  20635.         ioDrNmFls: INTEGER;
  20636.         filler3: ARRAY [1..9] OF INTEGER;
  20637.         ioDrCrDat: LONGINT;
  20638.         ioDrMdDat: LONGINT;
  20639.         ioDrBkDat: LONGINT;
  20640.         ioDrFndrInfo: DXInfo;
  20641.         ioDrParID: LONGINT);
  20642.     END;
  20643. æC 
  20644. »CInfoPBRec
  20645.  
  20646. The routines GetCatInfo and SetCatInfo are used for getting and setting information
  20647. about the files and directories within a directory. With files,
  20648. you’ll use the following 19 additional fields after the standard eight fields in the
  20649. parameter block record CInfoPBRec:
  20650.  
  20651.     ioFRefNum:      INTEGER;     {path reference number}
  20652.     ioFVersNum:     SignedByte;  {version number}
  20653.     filler1:        SignedByte;  {not used}
  20654.     ioFDirIndex:    INTEGER;     {index}
  20655.     ioFlAttrib:     SignedByte;  {file attributes}
  20656.     filler2:        SignedByte;  {not used}
  20657.   hFileInfo:
  20658.    (ioFlFndrInfo:   FInfo;       {information used by the Finder}
  20659.     ioDirID:        LONGINT;     {directory ID or file number}
  20660.     ioFlStBlk:      INTEGER;     {first allocation block of data fork}
  20661.     ioFlLgLen:      LONGINT;     {logical end-of-file of data fork}
  20662.     ioFlPyLen:      LONGINT;     {physical end-of-file of data fork}
  20663.     ioFlRStBlk:     INTEGER;     {first allocation block of resource fork}
  20664.     ioFlRLgLen:     LONGINT;     {logical end-of-file of resource fork}
  20665.     ioFlRPyLen:     LONGINT;     {physical end-of-file of resource fork}
  20666.     ioFlCrDat:      LONGINT;     {date and time of creation}
  20667.     ioFlMdDat:      LONGINT;     {date and time of last modification}
  20668.     ioFlBkDat:      LONGINT;     {date and time of last backup}
  20669.     ioFlXFndrInfo:  FXInfo;      {additional information used by the Finder}
  20670.     ioFlParID:      LONGINT;     {file's parent directory ID (integer)}
  20671.     ioFlClpSiz:     LONGINT);    {file's clump size}
  20672.  
  20673. •••Refer to Technical Note #69:•••
  20674.  
  20675. IOFDirIndex can be used with the function PBGetCatInfo to index through the files and
  20676. directories in a given directory. For each iteration of the function, you can determine
  20677. whether it’s a file or a directory by testing bit 4 (the fifth least significant bit)
  20678. of ioFlAttrib. You can test for a directory by using the Toolbox Utilities BitTst
  20679. function in the following manner (remember, the Toolbox Utilities routines reverse
  20680. the standard 68000 notation):
  20681.  
  20682.   BitTst(@myCInfoRec.ioFlAttrib,3)
  20683.  
  20684. IOFlAttrib contains the following attributes:
  20685.  
  20686.   Bit    Meaning
  20687.  
  20688.    0     Set if file is locked
  20689.    2     Set if resource fork is open
  20690.    3     Set if data fork is open
  20691.    4     Set if a directory
  20692.    7     Set if file (either fork) is open
  20693.  
  20694. When passed to a routine, ioDirID contains a directory ID; it can be used to refer to
  20695. a directory or, in conjuction with a partial pathname from that directory, to other
  20696. files and directories. If both a directory ID and a working directory reference
  20697. number are provided, the directory ID is used to identify the directory on the volume
  20698. indicated by the working directory reference number. In other words, a directory ID
  20699. specified by the caller will override the working directory referred to by the working
  20700. directory reference number. If you don’t want this to happen, you can set ioDirID to
  20701. 0. (If no directory is specified through a working directory reference number, the
  20702. root directory ID will be used.)
  20703.  
  20704. Warning:  With files, ioDirID returns the file number of the file; when
  20705.           indexing with GetCatInfo, you’ll need to reset this field for
  20706.           each iteration.
  20707.  
  20708. IOFlStBlk and ioFlRStBlk contain 0 if the file’s data or resource fork is empty,
  20709. respectively; they’re used only with flat volumes. The date and time in the ioFlCrDat,
  20710. ioFlMdDat, and ioFlBkDat fields are specified in seconds since midnight, January 1,
  20711. 1904.
  20712.  
  20713. IOFlParID contains the directory ID of the file’s parent. IOFlClpSiz is the clump
  20714. size to be used when writing the file; if it’s 0, the volume’s clump size is used
  20715. when the file is opened.
  20716.  
  20717. With directories, you’ll use the following 14 additional fields after the standard
  20718. eight fields in the parameter block record CInfoPBRec:
  20719.  
  20720.     ioFRefNum:     INTEGER;     {file reference number}
  20721.     ioFVersNum     SignedByte;  {version number}
  20722.     filler1:       SignedByte;  {not used}
  20723.     ioFDirIndex:   INTEGER;     {index}
  20724.     ioFlAttrib:    SignedByte;  {file attributes}
  20725.     filler2:       SignedByte;  {not used}
  20726.   dirInfo:
  20727.    (ioDrUsrWds:    DInfo;       {information used by the Finder}
  20728.     ioDrDirID:     LONGINT;     {directory ID}
  20729.     ioDrNmFls:     INTEGER;     {number of files in directory}
  20730.     filler3:       ARRAY[1..9] OF INTEGER; {not used}
  20731.     ioDrCrDat:     LONGINT;     {date and time of creation}
  20732.     ioDrMdDat:     LONGINT;     {date and time of last modification}
  20733.     ioDrBkDat:     LONGINT;     {date and time of last backup}
  20734.     ioDrFndrInfo:  DXInfo;      {additional information used by the Finder}
  20735.     ioDrParID:     LONGINT);    {directory's parent directory ID (integer)}
  20736.  
  20737. IOFDirIndex can be used with the function PBGetCatInfo to index through the files and
  20738. directories in a given directory. For each iteration of the function, you can determine
  20739. whether it’s a file or a directory by testing bit 4 of ioFlAttrib.
  20740.  
  20741. When passed to a routine, ioDrDirID contains a directory ID; it can be used to refer
  20742. to a directory or, in conjuction with a partial pathname from that directory, to
  20743. other files and directories. If both a directory ID and a working directory reference
  20744. number are provided, the directory ID is used to identify the directory on the volume
  20745. indicated by the working directory reference number. In other words, a directory ID
  20746. specified by the caller will override the working directory referred to by the working
  20747. directory reference number. If you don’t want this to happen, you can set ioDirID to
  20748. 0. (If no directory is specified through a working directory reference number, the
  20749. root directory ID will be used.)
  20750.  
  20751. With directories, ioDrDirID returns the directory ID of the directory.
  20752.  
  20753. IODrNmFls is the number of files and directories contained in this directory
  20754. (the valence of the directory).
  20755.  
  20756. The date and time in the ioDrCrDat, ioDrMdDat, and ioDrBkDat fields are specified in
  20757. seconds since midnight, January 1, 1904.
  20758.  
  20759. IODrParID contains the directory ID of the directory’s parent.
  20760.  
  20761. æKY DTPBRec
  20762. DTPBPtr
  20763. æFp Files.p
  20764. æT RECORD
  20765. æD DTPBPtr = ^DTPBRec;
  20766. DTPBRec = RECORD
  20767.     qLink: QElemPtr;
  20768.     qType: INTEGER;
  20769.     ioTrap: INTEGER;
  20770.     ioCmdAddr: Ptr;
  20771.     ioCompletion: ProcPtr;
  20772.     ioResult: OSErr;
  20773.     ioNamePtr: StringPtr;
  20774.     ioVRefNum: INTEGER;
  20775.     ioDTRefNum: INTEGER;
  20776.     ioIndex: INTEGER;
  20777.     ioTagInfo: LONGINT;
  20778.     ioDTBuffer: Ptr;
  20779.     ioDTReqCount: LONGINT;
  20780.     ioDTActCount: LONGINT;
  20781.     filler1: SignedByte;
  20782.     ioIconType: SignedByte;
  20783.     filler2: INTEGER;
  20784.     ioDirID: LONGINT;
  20785.     ioFileCreator: OSType;
  20786.     ioFileType: OSType;
  20787.     ioFiller3: LONGINT;
  20788.     ioDTLgLen: LONGINT;
  20789.     ioDTPyLen: LONGINT;
  20790.     ioFiller4: ARRAY [1..14] OF INTEGER;
  20791.     ioAPPLParID: LONGINT;
  20792.     END;
  20793. æC 
  20794.  
  20795. æKY CatPositionRec
  20796. æFp Files.p
  20797. æT RECORD
  20798. æD CatPositionRec = RECORD
  20799.     initialize: LONGINT;
  20800.     priv: ARRAY [1..6] OF Integer;
  20801.     END;
  20802. æC 
  20803.  
  20804. æKY FSSpec
  20805. æFp Files.p
  20806. æT RECORD
  20807. æD FSSpec = RECORD
  20808.     vRefNum: Integer;
  20809.     parID: LONGINT;
  20810.     name: Str63;
  20811.     END;
  20812. æC 
  20813.  
  20814. æKY FSSpecArray
  20815. FSSpecArrayPtr
  20816. FSSpecArrayHandle
  20817. æFp Files.p
  20818. æT RECORD
  20819. æD FSSpecArrayPtr = ^FSSpecArray;
  20820. FSSpecArrayHandle = ^FSSpecArrayPtr;
  20821.  
  20822. FSSpecArray = ARRAY [0..0] of FSSpec;
  20823. æC 
  20824.  
  20825. æKY HParamBlockRec
  20826. HParmBlkPtr
  20827. æFp Files.p
  20828. æT RECORD
  20829. æD HParmBlkPtr = ^HParamBlockRec;
  20830. HParamBlockRec = RECORD
  20831.     qLink: QElemPtr;
  20832.     qType: INTEGER;
  20833.     ioTrap: INTEGER;
  20834.     ioCmdAddr: Ptr;
  20835.     ioCompletion: ProcPtr;
  20836.     ioResult: OSErr;
  20837.     ioNamePtr: StringPtr;
  20838.     ioVRefNum: INTEGER;
  20839.     CASE ParamBlkType OF
  20840.       IOParam:
  20841.         (ioRefNum: INTEGER;
  20842.         ioVersNum: SignedByte;
  20843.         ioPermssn: SignedByte;
  20844.         ioMisc: Ptr;
  20845.         ioBuffer: Ptr;
  20846.         ioReqCount: LONGINT; {size of buffer area}
  20847.         ioActCount: LONGINT; {length of vol parms data}
  20848.         ioPosMode: INTEGER;
  20849.         ioPosOffset: LONGINT);
  20850.       FileParam:
  20851.         (ioFRefNum: INTEGER;
  20852.         ioFVersNum: SignedByte;
  20853.         filler1: SignedByte;
  20854.         ioFDirIndex: INTEGER;
  20855.         ioFlAttrib: SignedByte;
  20856.         ioFlVersNum: SignedByte;
  20857.         ioFlFndrInfo: FInfo;
  20858.         ioDirID: LONGINT;
  20859.         ioFlStBlk: INTEGER;
  20860.         ioFlLgLen: LONGINT;
  20861.         ioFlPyLen: LONGINT;
  20862.         ioFlRStBlk: INTEGER;
  20863.         ioFlRLgLen: LONGINT;
  20864.         ioFlRPyLen: LONGINT;
  20865.         ioFlCrDat: LONGINT;
  20866.         ioFlMdDat: LONGINT);
  20867.       VolumeParam:
  20868.         (filler2: LONGINT;
  20869.         ioVolIndex: INTEGER;
  20870.         ioVCrDate: LONGINT;
  20871.         ioVLsMod: LONGINT;
  20872.         ioVAtrb: INTEGER;
  20873.         ioVNmFls: INTEGER;
  20874.         ioVBitMap: INTEGER;
  20875.         ioAllocPtr: INTEGER;
  20876.         ioVNmAlBlks: INTEGER;
  20877.         ioVAlBlkSiz: LONGINT;
  20878.         ioVClpSiz: LONGINT;
  20879.         ioAlBlSt: INTEGER;
  20880.         ioVNxtCNID: LONGINT;
  20881.         ioVFrBlk: INTEGER;
  20882.         ioVSigWord: INTEGER;
  20883.         ioVDrvInfo: INTEGER;
  20884.         ioVDRefNum: INTEGER;
  20885.         ioVFSID: INTEGER;
  20886.         ioVBkUp: LONGINT;
  20887.         ioVSeqNum: INTEGER;
  20888.         ioVWrCnt: LONGINT;
  20889.         ioVFilCnt: LONGINT;
  20890.         ioVDirCnt: LONGINT;
  20891.         ioVFndrInfo: ARRAY [1..8] OF LONGINT);
  20892.       AccessParam:
  20893.         (filler3: INTEGER;
  20894.         ioDenyModes: INTEGER; {access rights data}
  20895.         filler4: INTEGER;
  20896.         filler5: SignedByte;
  20897.         ioACUser: SignedByte; {access rights for directory only}
  20898.         filler6: LONGINT;
  20899.         ioACOwnerID: LONGINT; {owner ID}
  20900.         ioACGroupID: LONGINT; {group ID}
  20901.         ioACAccess: LONGINT); {access rights}
  20902.       ObjParam:
  20903.         (filler7: INTEGER;
  20904.         ioObjType: INTEGER; {function code}
  20905.         ioObjNamePtr: Ptr; {ptr to returned creator/group name}
  20906.         ioObjID: LONGINT); {creator/group ID}
  20907.       CopyParam:
  20908.         (ioDstVRefNum: INTEGER; {destination vol identifier}
  20909.         filler8: INTEGER;
  20910.         ioNewName: Ptr; {ptr to destination pathname}
  20911.         ioCopyName: Ptr; {ptr to optional name}
  20912.         ioNewDirID: LONGINT); {destination directory ID}
  20913.       WDParam:
  20914.         (filler9: INTEGER;
  20915.         ioWDIndex: INTEGER;
  20916.         ioWDProcID: LONGINT;
  20917.         ioWDVRefNum: INTEGER;
  20918.         filler10: INTEGER;
  20919.         filler11: LONGINT;
  20920.         filler12: LONGINT;
  20921.         filler13: LONGINT;
  20922.         ioWDDirID: LONGINT);
  20923.       FIDParam:
  20924.         (filler14: LONGINT;
  20925.         ioDestNamePtr: StringPtr;
  20926.         filler15: LONGINT;
  20927.         ioDestDirID: LONGINT;
  20928.         filler16: LONGINT;
  20929.         filler17: LONGINT;
  20930.         ioSrcDirID: LONGINT;
  20931.     END;
  20932. æC 
  20933. »FileParam Variant ( ParamBlockRec and HParamBlockRec)
  20934.  
  20935. The fileParam variants of ParamBlockRec and HParamBlockRec are identical, with one
  20936. exception:  The field ioDirID in HParamBlockRec is called ioFlNum in ParamBlockRec.
  20937. The fields of the fileParam variant of HParamBlockRec are as follows:  
  20938.  
  20939. •••Refer to Technical Note #204:•••
  20940.  
  20941.   fileParam:
  20942.    (ioFRefNum:     INTEGER;     {path reference number}
  20943.     ioFVersNum:    SignedByte;  {version number}
  20944.     filler1:       SignedByte;  {not used}
  20945.     ioFDirIndex:   INTEGER;     {index}
  20946.     ioFlAttrib:    SignedByte;  {file attributes}
  20947.     ioFlVersNum:   SignedByte;  {version number}
  20948.     ioFlFndrInfo:  FInfo;       {information used by the Finder}
  20949.     ioDirID:       LONGINT;     {directory ID or file number}
  20950.     ioFlStBlk:     INTEGER;     {first allocation block of data fork}
  20951.     ioFlLgLen:     LONGINT;     {logical end-of-file of data fork}
  20952.     ioFlPyLen:     LONGINT;     {physical end-of-file of data fork}
  20953.     ioFlRStBlk:    INTEGER;     {first allocation block of resource fork}
  20954.     ioFlRLgLen:    LONGINT;     {logical end-of-file of resource fork}
  20955.     ioFlRPyLen:    LONGINT;     {physical end-of-file of resource fork}
  20956.     ioFlCrDat:     LONGINT;     {date and time of creation}
  20957.     ioFlMdDat:     LONGINT);    {date and time of last modification}
  20958.  
  20959. IOFDirIndex can be used with the PBGetFInfo and PBHGetFInfo to index through the
  20960. files in a given directory.
  20961.  
  20962. Warning:  When used with GetFileInfo, ioFDirIndex will index only the files
  20963.           in a directory. To index both files and directories, you can use
  20964.           ioFDirIndex with PBGetCatInfo.
  20965.  
  20966. IOFlAttrib contains the following file attributes:
  20967.  
  20968.   Bit    Meaning
  20969.  
  20970.    0     Set if file is locked
  20971.    2     Set if resource fork is open
  20972.    3     Set if data fork is open
  20973.    4     Set if a directory
  20974.    7     Set if file (either fork) is open
  20975.  
  20976. When passed to a routine, ioDirID contains a directory ID; it can be used to refer to
  20977. a directory or, in conjuction with a partial pathname from that directory, to other
  20978. files and directories. If both a directory ID and a working directory reference
  20979. number are provided, the directory ID is used to identify the directory on the volume
  20980. indicated by the working directory reference number. In other words, a directory ID
  20981. specified by the caller will override the working directory referred to by the working
  20982. directory reference number. If you don’t want this to happen, you can set ioDirID to
  20983. 0. (If no directory is specified through a working directory reference number, the
  20984. root directory ID will be used.)
  20985.  
  20986. When returned from a routine, ioDirID contains the file number of a file; most programmers
  20987. needn’t be concerned with file numbers, but those interested can read the section
  20988. “Data Organization on Volumes”.
  20989.  
  20990. IOFlStBlk and ioFlRStBlk contain 0 if the file’s data or resource fork is empty,
  20991. respectively; they’re used only with flat volumes. The date and time in the ioFlCrDat
  20992. and ioFlMdDat fields are specified in seconds since midnight,
  20993. January 1, 1904.
  20994.  
  20995. »VolumeParam Variant (ParamBlockRec)
  20996.  
  20997. When you call GetVolInfo, you’ll use the volumeParam variant of ParamBlockRec:
  20998.  
  20999.   volumeParam:
  21000.    (filler2:      LONGINT;    {not used}
  21001.     ioVolIndex:   INTEGER;    {index}
  21002.     ioVCrDate:    LONGINT;    {date and time of initialization}
  21003.     ioVLsBkUp:    LONGINT;    {date and time of last modification}
  21004.     ioVAtrb:      INTEGER;    {volume attributes}
  21005.     ioVNmFls:     INTEGER;    {number of files in root directory}
  21006.     ioVDirSt:     INTEGER;    {first block of directory}
  21007.     ioVBlLn:      INTEGER;    {length of directory in blocks}
  21008.     ioVNmAlBlks:  INTEGER;    {number of allocation blocks}
  21009.     ioVAlBlkSiz:  LONGINT;    {size of allocation blocks}
  21010.     ioVClpSiz:    LONGINT;    {number of bytes to allocate}
  21011.     ioAlBlSt:     INTEGER;    {first block in volume block map}
  21012.     ioVNxtFNum:   LONGINT;    {next unused file number}
  21013.     ioVFrBlk:     INTEGER);   {number of unused allocation blocks}
  21014.  
  21015. IOVolIndex can be used to index through all the mounted volumes; using an index of 1
  21016. accesses the first volume mounted, and so on. (For more information on indexing, see
  21017. the section “Indexing” above.)
  21018.  
  21019. IOVLsBkUp contains the date and time the volume information was last modified
  21020. (this is not necessarily when it was flushed). (This field is not modified when
  21021. information is written to a file.)
  21022.  
  21023. Note:  The name ioVLsBkUp is actually a misnomer; this field has always
  21024.        contained the date and time of the last modification to the volume,
  21025.        not the last backup.
  21026.  
  21027. Most programmers needn’t be concerned with the remaining parameters, but interested
  21028. programmers can read the section “Data Organization on Volumes”.
  21029.  
  21030. »VolumeParam Variant (HParamBlockRec)
  21031.  
  21032. When you call HGetVInfo and SetVolInfo, you’ll use the volumeParam variant of HParamBlockRec.
  21033. This is a superset of the volumeParam variant of ParamBlockRec; the names and functions
  21034. of certain fields have been changed, and new fields have been added:
  21035.  
  21036.   volumeParam:
  21037.    (filler2:      LONGINT;    {not used}
  21038.     ioVolIndex:   INTEGER;    {index}
  21039.     ioVCrDate:    LONGINT;    {date and time of initialization}
  21040.     ioVLsMod:     LONGINT;    {date and time of last modification}
  21041.     ioVAtrb:      INTEGER;    {volume attributes}
  21042.     ioVNmFls:     INTEGER;    {number of files in root directory}
  21043.     ioVBitMap:    INTEGER;    {first block of volume bit map}
  21044.     ioAllocPtr:   INTEGER;    {block at which next new file starts}
  21045.     ioVNmAlBlks:  INTEGER;    {number of allocation blocks}
  21046.     ioVAlBlkSiz:  LONGINT;    {size of allocation blocks}
  21047.     ioVClpSiz:    LONGINT;    {number of bytes to allocate}
  21048.     ioAlBlSt:     INTEGER;    {first block in volume block map}
  21049.     ioVNxtCNID:   LONGINT;    {next unused file number}
  21050.     ioVFrBlk:     INTEGER;    {number of unused allocation blocks}
  21051.     ioVSigWord:   INTEGER;    {volume signature}
  21052.     ioVDrvInfo:   INTEGER;    {drive number}
  21053.     ioVDRefNum:   INTEGER;    {driver reference number}
  21054.     ioVFSID:      INTEGER;    {file system handling this volume}
  21055.     ioVBkUp:      LONGINT;    {date and time of last backup}
  21056.     ioVSeqNum:    INTEGER;    {used internally}
  21057.     ioVWrCnt      LONGINT;    {volume write count}
  21058.     ioVFilCnt:    LONGINT;    {number of files on volume}
  21059.     ioVDirCnt:    LONGINT;    {number of directories on volume}
  21060.     ioVFndrInfo:  ARRAY[1..8] OF LONGINT); {information used by the Finder}
  21061.  
  21062. IOVolIndex can be used to index through all the mounted volumes; using an index of 1
  21063. accesses the first volume mounted, and so on. (For more information on indexing, see
  21064. the section “Indexing” above.)
  21065.  
  21066. IOVLsMod contains the date and time the volume information was last modified
  21067. (this is not necessarily when it was flushed). (This field is not modified when
  21068. information is written to a file.)
  21069.  
  21070. Note:  IOVLsMod replaces the field ioVLsBkUp in ParamBlockRec. The name
  21071.        ioVLsBkUp was actually a misnomer; this field has always contained
  21072.        the date and time of the last modification, not the last backup.
  21073.        Another field, ioVBkUp, contains the date and time of the last backup.
  21074.  
  21075. IOVClpSiz can be used to set the volume clump size in bytes; it’s used for files that
  21076. don’t have a clump size defined as part of their file information in the catalog. To
  21077. promote file contiguity and avoid fragmentation, space is allocated to a file not in
  21078. allocation blocks but in clumps. A clump is a group of contiguous allocation blocks.
  21079. The clump size is always a multiple of the allocation block size; it’s the minimum
  21080. number of bytes to allocate each time the Allocate function is called or the end-of-file
  21081. is reached during the Write routine.
  21082.  
  21083. IOVSigWord contains a signature word identifying the type of volume; it’s $D2D7 for
  21084. flat directory volumes and $4244 for hierarchical directory volumes. The drive number
  21085. of the drive containing the volume is returned in ioDrvInfo. For on-line volumes,
  21086. ioVDRefNum returns the reference number of the I/O driver for the drive identified by
  21087. ioDrvInfo.
  21088.  
  21089. IOVFSID is the file-system identifier. It indicates which file system is servicing
  21090. the volume; it’s 0 for File Manager volumes and nonzero for volumes handled by an
  21091. external file system.
  21092.  
  21093. IOVBkUp specifies the date and time the volume was last backed up (it’s 0 if never
  21094. backed up).
  21095.  
  21096. IOVNmFls contains the number of files in the root directory. IOVFilCnt contains the
  21097. total number of files on the volume, while ioVDirCnt contains the total number of
  21098. directories (not including the root directory).
  21099.  
  21100. Most programmers needn’t be concerned with the other parameters, but interested
  21101. programmers can read the section “Data Organization on Volumes”.
  21102.  
  21103. HParamBlockRec, described above, has been extended to support a shared environment
  21104. with the addition of AccessParam, ObjParam, CopyParam, and
  21105. WDParam, as shown below.  (The complete HParamBlockRec data type is shown in the
  21106. summary.)
  21107.  
  21108.   AccessParam:
  21109.    (filler3:       INTEGER;
  21110.     ioDenyModes:   INTEGER;      {access rights data}
  21111.     filler4:       INTEGER;
  21112.     filler5:       Signed Byte;
  21113.     ioACUser:      Signed Byte;  {access rights for directory only}
  21114.     filler6:       LONGINT;
  21115.     ioACOwnerID:   LONGINT;      {owner ID}
  21116.     ioACGroupID:   LONGINT;      {group ID}
  21117.     ioACAccess:    LONGINT);     {access rights}
  21118.  
  21119.   ObjParam:
  21120.    (filler7:       INTEGER;
  21121.     ioObjType:     INTEGER;   {function code}
  21122.     ioObjNamePtr:  Ptr;       {ptr to returned creator/group name}
  21123.     ioObjID:       LONGINT;   {creator/group ID}
  21124.     ioReqCount:    LONGINT;   {size of buffer area}
  21125.     ioActCount:    LONGINT);  {length of vol parms data}
  21126.  
  21127.   CopyParam:
  21128.    (ioDstVRefNum:  INTEGER;   {destination vol identifier}
  21129.     filler8:       INTEGER;
  21130.     ioNewName:     Ptr;       {ptr to destination pathname}
  21131.     ioCopyName:    Ptr;       {ptr to optional name}
  21132.     ioNewDirID:    LONGINT);  {destination directory ID}
  21133.  
  21134.   WDParam:
  21135.    (filler9:       INTEGER;
  21136.     ioWDIndex:     INTEGER;
  21137.     ioWDProcID:    LONGINT;
  21138.     ioWDVRefNum:   INTEGER;
  21139.     filler10:      INTEGER;
  21140.     filler11:      LONGINT;
  21141.     filler12:      LONGINT;
  21142.     filler13:      LONGINT;
  21143.     ioWDDirID:     LONGINT);
  21144.  
  21145. æKY NumVersion
  21146. æFp Files.p
  21147. æT RECORD
  21148. æD NumVersion = PACKED RECORD
  21149.     CASE INTEGER OF
  21150.       0:
  21151.         (majorRev: SignedByte; {1st part of version number in BCD}
  21152.         minorRev: 0..9; {2nd part is 1 nibble in BCD}
  21153.         bugFixRev: 0..9; {3rd part is 1 nibble in BCD}
  21154.         stage: SignedByte; {stage code: dev, alpha, beta, final}
  21155.         nonRelRev: SignedByte); {revision level of non-released version}
  21156.       1:
  21157.         (version: LONGINT); {to use all 4 fields at one time}
  21158.     END;
  21159. { Numeric version part of 'vers' resource }
  21160. æC 
  21161.  
  21162. æKY VersRec
  21163. VersRecPtr
  21164. VersRecHndl
  21165. æFp Files.p
  21166. æT RECORD
  21167. æD VersRecPtr = ^VersRec;
  21168. VersRecHndl = ^VersRecPtr;
  21169. VersRec = RECORD
  21170.     numericVersion: NumVersion; {encoded version number}
  21171.     countryCode: INTEGER; {country code from intl utilities}
  21172.     shortVersion: Str255; {version number string - worst case}
  21173.     reserved: Str255; {longMessage string packed after shortVersion}
  21174.     END;
  21175. { 'vers' resource format }
  21176. æC 
  21177.  
  21178. æKY PBHGetVolParms
  21179. æFp Files.p
  21180. æT FUNCTION
  21181. æD FUNCTION PBHGetVolParms(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21182. æDT myVariable := PBHGetVolParms(paramBlock,async);
  21183. æRI V-392, VI
  21184. æC 
  21185. Trap macro    _GetVolParms
  21186.  
  21187. Parameter block
  21188.   Æ   12  ioCompletion  long  pointer to completion routine
  21189.   ¨   16  ioResult      word  error result code
  21190.   Æ   18  ioFileName    long  volume name specifier
  21191.   Æ   22  ioVRefNum     word  volume refNum
  21192.   ¨   32  ioBuffer      long  pointer to attributes buffer
  21193.   Æ   36  ioReqCount    long  size of buffer area
  21194.   ¨   40  ioActCount    long  length of volume parms data
  21195.  
  21196. <See the description in Volume V. We have a new version of the attributes buffer
  21197. and new values for vMAttrib:>
  21198.  
  21199. Attributes buffer
  21200.   0  vMVersion        word    version number (02 for this version)
  21201.   2  vMAttrib         long    attributes (detailed below)
  21202.   6  vMLocalHand      long    handle to private data for shared volumes
  21203.   10  vMServerAdr     long    AppleTalk server address (0 if not supported)
  21204.   14  vMVolumeGrade   long    Approximate speed rating of volume
  21205.   18  vMAltPrivModel  word    Alternative privilege model supported
  21206.                               (two values currently defined:
  21207.                                0 for an HFS volume;
  21208.                                1 for an A/UX volume)
  21209.  
  21210. Bit positions in vMAttrib
  21211.   31  bLimitFCBs   Limit the number of FCBs used during copying
  21212.                    to 8 instead of 16.
  21213.  
  21214.   30  bLocalWList  Use the returned shared volume handle for the
  21215.                    Finder’s local window list.
  21216.  
  21217.   29  bNoMiniFndr  Disable Mini Finder menu item.
  21218.  
  21219.   28  bNoVNEdit  Lock volume name against editing.
  21220.  
  21221.   27  bNoLclSync  Do not let Finder change the modification date.
  21222.  
  21223.   26  bTrshOffLine  Zoom volume when it goes off line 
  21224.                     to the Trash and when it’s unmounted.
  21225.  
  21226.   25  bNoSwitchTo  Do not switch-launch to any application on the
  21227.                    volume.
  21228.  
  21229.   24-21  Reserved. Server volumes return these bits set.
  21230.                    All other volumes return these bits cleared.
  21231.  
  21232.   20  bNoDeskItems  Do not place objects on the Finder desktop.
  21233.  
  21234.   19  bNoBootBlks  Not a startup volume.
  21235.                    Startup menu item disabled.
  21236.                    Bootblocks not copied.
  21237.  
  21238.   18  bAccessCntl  Volume supports AppleTalk AFP access 
  21239.                    control interfaces. The functions GetLoginInfo, 
  21240.                    GetDirAccess, SetDirAccess, MapID, and 
  21241.                    MapName are supported. Special folder icons are 
  21242.                    used. Access Privileges menu item is enabled
  21243.                    for disk and folder items. The privileges field of 
  21244.                    GetCatInfo calls are assumed to be valid.
  21245.  
  21246.   17  bNoSysDir  Volume doesn’t support a system directory.
  21247.  
  21248.       Do not switch launch to this volume.
  21249.  
  21250.   16  bExtFSVol  Volume is an external file system volume. 
  21251.       Disk initialization package is not called. Erase 
  21252.       Disk menu item is disabled.
  21253.  
  21254.   15  bHasOpenDeny  Volume supports _OpenDeny and 
  21255.                     _OpenRFDeny. For copy operations, source files
  21256.                     are opened with enable read/deny write and 
  21257.                     destination files are opened enable write/deny 
  21258.                     read and write.
  21259.  
  21260.   14  bHasCopyFile  Volume supports _CopyFile. _CopyFile is 
  21261.                     used in copy and duplicate operations if both 
  21262.                     source and destination volumes have same server
  21263.                     address.
  21264.  
  21265.   13  bHasMoveRename  Volume supports _MoveRename.
  21266.  
  21267.   12  bHasNewDesk  Volume supports all of the new desktop 
  21268.                    functions (described in Volume V).
  21269.  
  21270.   11  bHasShortName  Volume supports a name that fits the requirements
  21271.                      of another file system.
  21272.  
  21273.   10  bHasFolderLock  Folder is locked.
  21274.  
  21275.    9  bHasPersonalAccessPrivileges  Macintosh File Share is running.
  21276.  
  21277.    8  bHasUserGroupList  Volume supports the Users and Groups file and
  21278.                          thus the AFP privilege functions.
  21279.  
  21280.    7  bHasCatSearch  Volume supports PBCatSearch.
  21281.  
  21282.    6  bHasFileIDs  Volume supports fileID functions
  21283.  
  21284.    5  For internal use only
  21285.  
  21286.   4-0 Reserved. All volumes return these bits clear.
  21287.  
  21288. æKY PBHGetLogInInfo
  21289. æFp Files.p
  21290. æT FUNCTION
  21291. æD FUNCTION PBHGetLogInInfo(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21292. æDT myVariable := PBHGetLogInInfo(paramBlock,async);
  21293. æRI V-393
  21294. æC 
  21295. Trap macro    _GetLogInInfo
  21296.  
  21297. Parameter block
  21298.   -->    12    ioCompletion  long    optional completion routine ptr
  21299.   <--    16    ioResult      word    error result code
  21300.   -->    22    ioVRefNum     word    volume refNum
  21301.   <--    26    ioObjType     word    log in method
  21302.   <--    28    ioObjNamePtr  long    ptr to log in name buffer
  21303.  
  21304. PBHGetLogInInfo returns the method used for log-in and the user name specified at
  21305. log-in time for the volume.  The log-in user name is returned as a Pascal string in
  21306. ioObjNamePtr.  The maximum size of the user name is 31 characters.  The log-in method
  21307. type is returned in ioObjType.
  21308.  
  21309. æKY PBHGetDirAccess
  21310. æFp Files.p
  21311. æT FUNCTION
  21312. æD FUNCTION PBHGetDirAccess(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21313. æDT myVariable := PBHGetDirAccess(paramBlock,async);
  21314. æRI V-394
  21315. æC 
  21316. Trap macro    _GetDirAccess
  21317.  
  21318. Parameter block
  21319.   -->    12    ioCompletion  long    optional completion routine ptr
  21320.   <--    16    ioResult      word    error result code
  21321.   -->    18    ioFileName    long    directory name
  21322.   -->    22    ioVRefNum     word    volume refNum
  21323.   <--    36    ioACOwnerID   long    owner ID
  21324.   <--    40    ioACGroupID   long    group ID
  21325.   <--    44    ioACAccess    long    access rights
  21326.   -->    48    ioDirID       long    directory ID
  21327.  
  21328. PBHGetDirAccess returns access control information for the folder pointed to by the
  21329. ioDirID/ioFIleName pair.  ioACOwnerID will return the ID for the folder’s owner. 
  21330. ioACGroupID will return the ID for the folder’s primary group.  The access rights are
  21331. returned in ioACAccess.
  21332.  
  21333. A fnfErr is returned if the pathname does not point to a valid directory.  An AccessDenied
  21334. error is returned if the user does not have the correct access rights to examine this
  21335. directory.
  21336.  
  21337. æKY PBHSetDirAccess
  21338. æFp Files.p
  21339. æT FUNCTION
  21340. æD FUNCTION PBHSetDirAccess(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21341. æDT myVariable := PBHSetDirAccess(paramBlock,async);
  21342. æRI V-394
  21343. æC 
  21344. Trap macro    _SetDirAccess
  21345.  
  21346. Parameter block
  21347.   -->    12    ioCompletion  long    optional completion routine ptr
  21348.   <--    16    ioResult      word    error result code
  21349.   -->    18    ioFileName    long    pathname identifier
  21350.   -->    22    ioVRefNum     word    volume refNum
  21351.   -->    36    ioACOwnerID   long    owner ID
  21352.   -->    40    ioACGroupID   long    group ID
  21353.   -->    44    ioACAccess    long    access rights
  21354.   -->    48    ioDirID       long    directory ID
  21355.  
  21356. PBHSetDirAccess allows you to change the access rights to a folder pointed to by the
  21357. ioFileName/ioDirID pair.  IOACOwnerID contains the new owner ID.  IOACGroupID contains
  21358. the group ID.  IOACAccess contains the folder’s access rights.  You cannot set the
  21359. owner bit or the user’s rights of the directory.  To change the owner or group, you
  21360. should set the ioACOwnerID or ioACGroupID field with the appropriate ID of the new
  21361. owner/group.  You must be the owner of the directory to change the owner or group
  21362. ID.
  21363.  
  21364. A fnfErr is returned if the pathname does not point to a valid directory.  An AccessDenied
  21365. error is returned if you do not have the correct access rights to modify the parameters
  21366. for this directory.  A paramErr is returned if you try to set the owner bit or user’s
  21367. rights bits.
  21368.  
  21369. æKY PBHMapID
  21370. æFp Files.p
  21371. æT FUNCTION
  21372. æD FUNCTION PBHMapID(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21373. æDT myVariable := PBHMapID(paramBlock,async);
  21374. æRI V-395
  21375. æC 
  21376. Trap macro    _MapID
  21377.  
  21378. Parameter block
  21379.   -->    12    ioCompletion  long    optional completion routine ptr
  21380.   <--    16    ioResult      word    error result code
  21381.   -->    18    ioFileName    long    pathname identifier
  21382.   -->    22    ioVRefNum     word    volume refNum
  21383.   -->    26    ioObjType     word    function code
  21384.   <--    28    ioObjNamePtr  long    ptr to retrnd creator/group name
  21385.   -->    32    ioObjID       long    creator/group ID
  21386.  
  21387. PBHMapID returns the name of a user or group given its unique ID.  IOObjID contains
  21388. the ID to be mapped.  The value zero for ioObjID is special cased and will always
  21389. return a NIL name.  AppleShare uses this to signify <Any User>.  IOObjType is the
  21390. mapping function code; it’s 1 if you’re mapping an owner ID to owner name or 2 if
  21391. you’re mapping a group ID to a group name.  The name is returned as a Pascal string
  21392. in ioObjNamePtr.  The maximum size of the name is 31 characters.
  21393.  
  21394. A fnfErr is returned if an unrecognizable owner or group ID is passed.
  21395.  
  21396. æKY PBHMapName
  21397. æFp Files.p
  21398. æT FUNCTION
  21399. æD FUNCTION PBHMapName(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21400. æDT myVariable := PBHMapName(paramBlock,async);
  21401. æRI V-395
  21402. æC 
  21403. Trap macro    _MapName
  21404.  
  21405. Parameter block
  21406.   -->    12    ioCompletion  long    optional completion routine ptr
  21407.   <--    16    ioResult      word    error result code
  21408.   -->    18    ioFileName    long    volume identifier (may be NIL)
  21409.   -->    22    ioVRefNum     word    volume refNum
  21410.   -->    28    ioObjNamePtr  long    owner or group name
  21411.   -->    26    ioObjType     word    function code
  21412.   <--    32    ioObjID       long    creator/group ID
  21413.  
  21414. PBHMapName returns the unique user ID or group ID given its name.  The name is passed
  21415. as a string in ioObjNamePtr.  If a NIL name is passed, the ID returned will always be
  21416. zero.  The maximum size of the name is 31 characters.  IOObjType is the mapping
  21417. function code; it’s 3 if you’re mapping an owner name to owner ID or 4 if you’re
  21418. mapping a group name to a group ID.  IOObjID will contain the mapped ID.
  21419.  
  21420. A fnfErr is returned if an unrecognizable owner or group name is passed.
  21421.  
  21422. æKY PBHCopyFile
  21423. æFp Files.p
  21424. æT FUNCTION
  21425. æD FUNCTION PBHCopyFile(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21426. æDT myVariable := PBHCopyFile(paramBlock,async);
  21427. æRI V-396
  21428. æC 
  21429. Trap macro    _CopyFile
  21430.  
  21431. Parameter block
  21432.   -->    12    ioCompletion  long    optional completion routine ptr
  21433.   <--    16    ioResult      word    error result code
  21434.   -->    18    ioFileName    long    ptr to source pathname
  21435.   -->    22    ioVRefNum     word    source vol identifier
  21436.   -->    24    ioDstVRefNum  word    destination vol identifier
  21437.   -->    28    ioNewName     long    ptr to destination pathname
  21438.   -->    32    ioCopyName    long    ptr to optional name (may be NIL)
  21439.   -->    36    ioNewDirID    long    destination directory ID
  21440.   -->    48    ioDirID       long    source directory ID
  21441.  
  21442. PBHCopyFile duplicates a file on the volume and optionally renames it.  It is an
  21443. optional call for AppleShare file servers.  You should examine the returned flag
  21444. information in the PBHGetVolParms call to see if this volume supports CopyFile.
  21445.  
  21446. For AppleShare file servers, the source and destination pathnames must indicate the
  21447. same file server; however, it may point to a different volume for that file server. 
  21448. A useful way to tell if two file server volumes are on the same file server is to
  21449. make the GetVolParms call and compare the server addresses returned.  The server will
  21450. open source files with read/deny write enabled and destination files with write/deny
  21451. read and write enabled.
  21452.  
  21453. IOVRefNum contains a source volume identifier.  The source pathname is determined by
  21454. the ioFileName/ioDirID pair.  IODstVRefNum contains a destination volume identifier. 
  21455. AppleShare 1.0 required that it be an actual volume reference number; however, on
  21456. future versions it can be a WDRefNum.  The destination pathname is determined by the
  21457. ioNewName/ioNewDirID pair.  IOCopyName may contain an optional string used in renaming
  21458. the file.  If it is non-NIL then the file copy will be renamed to the specified name
  21459. in ioCopyName.
  21460.  
  21461. A fnfErr is returned if the source pathname does not point to an existing file or the
  21462. destination pathname does not point to an existing directory.  An AccessDenied error
  21463. is returned if the user does not have the right to read the source or write to the
  21464. destination.  A dupFnErr is returned if the destination already exists.  A DenyConflict
  21465. error is returned if either the source or destination file could not be opened under
  21466. the access modes described above.
  21467.  
  21468. æKY PBHMoveRename
  21469. æFp Files.p
  21470. æT FUNCTION
  21471. æD FUNCTION PBHMoveRename(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21472. æDT myVariable := PBHMoveRename(paramBlock,async);
  21473. æRI V-397
  21474. æC 
  21475. Trap macro    _MoveRename
  21476.  
  21477. Parameter block
  21478.   -->    12    ioCompletion  long    optional completion routine ptr
  21479.   <--    16    ioResult      word    error result code
  21480.   -->    18    ioFileName    long    ptr to source pathname
  21481.   -->    22    ioVRefNum     word    source vol identifier
  21482.   -->    28    ioNewName     long    ptr to destination pathname
  21483.   -->    32    ioBuffer      long    ptr to optional name (may be NIL)
  21484.   -->    36    ioNewDirID    long    destination directory ID
  21485.   -->    48    ioDirID       long    source directory ID
  21486.  
  21487. PBHMoveRename allows you to move (not copy) an item and optionally to rename it.  The
  21488. source and destination pathnames must point to the same file server volume.
  21489.  
  21490. IOVRefNum contains a source volume identifier.  The source pathname is specified by
  21491. the ioFileName/ioDirID pair.  The destination pathname is specified by the ioNewName/ioNewDirID
  21492. pair.  IOBuffer may contain an optional string used in renaming the item.  If it is
  21493. non-NIL then the moved object will be renamed to the specified name in ioBuffer.
  21494.  
  21495. A fnfErr is returned if the source pathname does not point to an existing object.  An
  21496. AccessDenied error is returned if the user does not have the right to move the object.
  21497.  A dupFnErr is returned if the destination already exists.  A badMovErr is returned
  21498. if an attempt is made to move a directory into one of its descendent directories.
  21499.  
  21500. æKY PBHOpenDeny
  21501. æFp Files.p
  21502. æT FUNCTION
  21503. æD FUNCTION PBHOpenDeny(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21504. æDT myVariable := PBHOpenDeny(paramBlock,async);
  21505. æRI V-398
  21506. æC 
  21507. Trap macro    _OpenDeny
  21508.  
  21509. Parameter block
  21510.   -->    12    ioCompletion  long    optional completion routine ptr
  21511.   <--    16    ioResult      word    error result code
  21512.   -->    18    ioFileName    long    ptr to pathname
  21513.   -->    22    ioVRefNum     word    vol identifier
  21514.   <--    24    ioRefNum      word    file refNum
  21515.   -->    26    ioDenyModes   word    access rights data
  21516.   -->    48    ioDirID       long    directory ID
  21517.  
  21518. PBHOpenDeny opens a file’s data fork under specific access rights.  It creates an
  21519. access path to the file having the name pointed to by ioFileName/ioDirID.  The path
  21520. reference number is returned in ioRefNum.
  21521.  
  21522. IODenyModes contains a word of access rights information.  The format for these
  21523. access rights is:
  21524.  
  21525.     bits    15–6    Reserved—should be cleared.
  21526.             5       If set, other writers are denied access.
  21527.             4       If set, other readers are denied access.
  21528.             3–2     Reserved—should be cleared.
  21529.             1       If set, write permission requested.
  21530.             0       If set, read permission requested.
  21531.  
  21532. A fnfErr is returned if the input specification does not point to an existing file. 
  21533. A permErr is returned if the file is already open and you cannot open it under the
  21534. deny modes that you have specified.  An opWrErr is returned if you have asked for
  21535. write permission and the file is already opened by you for write.  The already opened
  21536. path reference number is returned in ioRefNum.  An AccessDenied error is returned if
  21537. you do not have the right to access the file.
  21538.  
  21539. æKY PBHOpenRFDeny
  21540. æFp Files.p
  21541. æT FUNCTION
  21542. æD FUNCTION PBHOpenRFDeny(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  21543. æDT myVariable := PBHOpenRFDeny(paramBlock,async);
  21544. æRI V-398
  21545. æC 
  21546. Trap macro    _OpenRFDeny
  21547.  
  21548. Parameter block
  21549.   -->    12    ioCompletion  long    optional completion routine ptr
  21550.   <--    16    ioResult      word    error result code
  21551.   -->    18    ioFileName    long    ptr to pathname
  21552.   -->    22    ioVRefNum     word    vol identifier
  21553.   <--    24    ioRefNum      word    file refNum
  21554.   -->    26    ioDenyModes   word    access rights data
  21555.   -->    48    ioDirID       long    directory ID
  21556.  
  21557. PBHOpenRFDeny opens a file’s resource fork under specific access rights.
  21558. It creates an access path to the file having the name pointed to by
  21559. ioFileName/ioDirID.  The path reference number is returned in ioRefNum.  The format
  21560. of the access rights data contained in ioDenyModes is described under the OpenDeny
  21561. call.
  21562.  
  21563. A fnfErr is returned if the input specification does not point to an existing file. 
  21564. A permErr is returned if the file is already open and you cannot open it under the
  21565. deny modes that you have specified.  An opWrErr is returned if you have asked for
  21566. write permission and the file is already opened by you for write.  The already-opened
  21567. path reference number is returned in ioRefNum.  An AccessDenied error is returned if
  21568. you do not have the right to access the file.
  21569.  
  21570. æKY PBOpen
  21571. æFp Files.p
  21572. æT FUNCTION
  21573. æD FUNCTION PBOpen(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21574. æDT myVariable := PBOpen(paramBlock,async);
  21575. æRI II-108
  21576. æC 
  21577. Trap macro    _Open
  21578.  
  21579. Parameter block
  21580.   -->    12    ioCompletion  pointer
  21581.   <--    16    ioResult      word
  21582.   -->    18    ioNamePtr     pointer
  21583.   -->    22    ioVRefNum     word
  21584.   <--    24    ioRefNum      word
  21585.   -->    26    ioVersNum     byte
  21586.   -->    27    ioPermssn     byte
  21587.   -->    28    ioMisc        pointer
  21588.  
  21589. PBOpen creates an access path to the file having the name pointed to by ioNamePtr
  21590. (and on flat volumes, the version number ioVersNum) on the volume specified by ioVRefNum.
  21591. A path reference number is returned in ioRefNum.
  21592.  
  21593. IOMisc either points to a portion of memory (522 bytes) to be used as the access
  21594. path’s buffer, or is NIL if you want the volume buffer to be used instead.
  21595.  
  21596. Warning:  All access paths to a single file that’s opened multiple times
  21597.           should share the same buffer so that they will read and write
  21598.           the same data.
  21599.  
  21600. IOPermssn specifies the path’s read/write permission. A path can be opened for writing
  21601. even if it accesses a file on a locked volume, and an error won’t be returned until a
  21602. PBWrite, PBSetEOF, or PBAllocate call is made.
  21603.  
  21604. If you attempt to open a locked file for writing, PBOpen will return permErr as its
  21605. function result. If you request exclusive read/write permission but another access
  21606. path already has write permission (whether write only, exclusive
  21607. read/write, or shared read/write), PBOpen will return the reference number of the
  21608. existing access path in ioRefNum and opWrErr as its function result. Similarly, if
  21609. you request shared read/write permission but another access path already has exclusive
  21610. read/write permission, PBOpen will return the reference number of the access path in
  21611. ioRefNum and opWrErr as its function result.
  21612.  
  21613. Result codes    noErr     No error
  21614.                 bdNamErr  Bad file name
  21615.                 extFSErr  External file system
  21616.                 fnfErr    File not found
  21617.                 ioErr     I/O error
  21618.                 nsvErr    No such volume
  21619.                 opWrErr   File already open for writing
  21620.                 permErr   Attempt to open locked file for writing
  21621.                 tmfoErr   Too many files open
  21622.  
  21623. æKY PBClose
  21624. æFp Files.p
  21625. æT FUNCTION
  21626. æD FUNCTION PBClose(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21627. æDT myVariable := PBClose(paramBlock,async);
  21628. æRI II-114
  21629. æC 
  21630. Trap macro     _Close
  21631.  
  21632. Parameter block
  21633.   -->    12    ioCompletion  pointer
  21634.   <--    16    ioResult      word
  21635.   -->    24    ioRefNum      word
  21636.  
  21637. PBClose writes the contents of the access path buffer specified by ioRefNum to the
  21638. volume and removes the access path.
  21639.  
  21640. Warning:  Some information stored on the volume won’t be correct
  21641.           until PBFlushVol is called.
  21642.  
  21643. Result codes    noErr     No error
  21644.                 extFSErr  External file system
  21645.                 fnfErr    File not found
  21646.                 fnOpnErr  File not open
  21647.                 ioErr     I/O error
  21648.                 nsvErr    No such volume
  21649.                 rfNumErr  Bad reference number
  21650.  
  21651. æKY PBRead
  21652. æFp Files.p
  21653. æT FUNCTION
  21654. æD FUNCTION PBRead(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21655. æDT myVariable := PBRead(paramBlock,async);
  21656. æRT 187
  21657. æRI II-110
  21658. æC  
  21659. Trap macro    _Read
  21660.  
  21661. Parameter block
  21662.   -->    12    ioCompletion  pointer
  21663.   <--    16    ioResult      word
  21664.   -->    24    ioRefNum      word
  21665.   -->    32    ioBuffer      pointer
  21666.   -->    36    ioReqCount    long word
  21667.   <--    40    ioActCount    long word
  21668.   -->    44    ioPosMode     word
  21669.   <->    46    ioPosOffset   long word
  21670.  
  21671. PBRead attempts to read ioReqCount bytes from the open file whose access path is
  21672. specified by ioRefNum, and transfer them to the data buffer pointed to by ioBuffer.
  21673. The position of the mark is specified by ioPosMode and ioPosOffset. If you try to
  21674. read past the logical end-of-file, PBRead moves the mark to the end-of-file and
  21675. returns eofErr as its function result. After the read is completed, the mark is
  21676. returned in ioPosOffset and the number of bytes actually read is returned in ioActCount.
  21677.  
  21678. Result codes    noErr     No error
  21679.                 eofErr    End-of-file
  21680.                 extFSErr  External file system
  21681.                 fnOpnErr  File not open
  21682.                 ioErr     I/O error
  21683.                 paramErr  Negative ioReqCount
  21684.                 rfNumErr  Bad reference number
  21685.  
  21686. æKY PBWrite
  21687. æFp Files.p
  21688. æT FUNCTION
  21689. æD FUNCTION PBWrite(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21690. æDT myVariable := PBWrite(paramBlock,async);
  21691. æRT 187
  21692. æRI II-110
  21693. æC 
  21694.  
  21695. •••Refer to Technical Note #187:•••
  21696.  
  21697. Trap macro    _Write
  21698.  
  21699. Parameter block
  21700.   -->    12    ioCompletion  pointer
  21701.   <--    16    ioResult      word
  21702.   -->    24    ioRefNum      word
  21703.   -->    32    ioBuffer      pointer
  21704.   -->    36    ioReqCount    long word
  21705.   <--    40    ioActCount    long word
  21706.   -->    44    ioPosMode     word
  21707.   <->    46    ioPosOffset   long word
  21708.  
  21709. PBWrite takes ioReqCount bytes from the buffer pointed to by ioBuffer and attempts to
  21710. write them to the open file whose access path is specified by ioRefNum. The position
  21711. of the mark is specified by ioPosMode and ioPosOffset. After the write is completed,
  21712. the mark is returned in ioPosOffset and the number of bytes actually written is
  21713. returned in ioActCount.
  21714.  
  21715. Result codes    noErr      No error
  21716.                 dskFulErr  Disk full
  21717.                 fLckdErr   File locked
  21718.                 fnOpnErr   File not open
  21719.                 ioErr      I/O error
  21720.                 paramErr   Negative ioReqCount
  21721.                 posErr     Attempt to position before start of file
  21722.                 rfNumErr   Bad reference number
  21723.                 vLckdErr   Software volume lock
  21724.                 wPrErr     Hardware volume lock
  21725.                 wrPermErr  Read/write permission doesn’t allow writing
  21726.  
  21727. æKY PBGetVInfo
  21728. æFp Files.p
  21729. æT FUNCTION
  21730. æD FUNCTION PBGetVInfo(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21731. æDT myVariable := PBGetVInfo(paramBlock,async);
  21732. æRT 24, 44, 157
  21733. æRI II-104, IV-129, N24-1, N44-2, N157
  21734. æC 
  21735. Trap macro    _GetVolInfo
  21736.  
  21737. Parameter block
  21738.   -->    12    ioCompletion  pointer
  21739.   <--    16    ioResult      word
  21740.   <->    18    ioNamePtr     pointer
  21741.   <->    22    ioVRefNum     word
  21742.   -->    28    ioVolIndex    word
  21743.   <--    30    ioVCrDate     long word
  21744.   <--    34    ioVLsBkUp     long word
  21745.   <--    38    ioVAtrb       word
  21746.   <--    40    ioVNmFls      word
  21747.   <--    42    ioVDirSt      word
  21748.   <--    44    ioVBlLn       word
  21749.   <--    46    ioVNmAlBlks   word
  21750.   <--    48    ioVAlBlkSiz   long word
  21751.   <--    52    ioVClpSiz     long word
  21752.   <--    56    ioAlBlSt      word
  21753.   <--    58    ioVNxtFNum    long word
  21754.   <--    62    ioVFrBlk      word
  21755.  
  21756. PBGetVInfo returns information about the specified volume. If ioVolIndex is positive,
  21757. the File Manager attempts to use it to find the volume; for instance, if ioVolIndex
  21758. is 2, the File Manager will attempt to access the second mounted volume. If ioVolIndex
  21759. is negative, the File Manager uses ioNamePtr and ioVRefNum in the standard way (described
  21760. in the section “Specifying Volumes, Directories, and Files”) to determine which
  21761. volume. If ioVolIndex is 0, the File Manager attempts to access the volume by using
  21762. ioVRefNum only. The volume reference number is returned in ioVRefNum, and a pointer
  21763. to the volume name is returned in ioNamePtr (unless ioNamePtr is NIL).
  21764.  
  21765. If a working directory reference number is passed in ioVRefNum (or if the default
  21766. directory is a subdirectory), the number of files and directories in the specified
  21767. directory (the directory’s valence) will be returned in ioVNmFls. Also, the volume
  21768. reference number won’t be returned; ioVRefNum will still contain the working directory
  21769. reference number.
  21770.  
  21771. Warning:  IOVNmAlBlks and ioVFrBlks, which are actually unsigned integers,
  21772.           are clipped to 31744 ($7C00) regardless of the size of the volume.
  21773.  
  21774. Result codes    noErr       No error
  21775.                 nsvErr      No such volume
  21776.                 paramErr    No default volume
  21777.  
  21778. æKY PBGetVol
  21779. æFp Files.p
  21780. æT FUNCTION
  21781. æD FUNCTION PBGetVol(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21782. æDT myVariable := PBGetVol(paramBlock,async);
  21783. æRI II-104, IV-131
  21784. æC 
  21785. Trap macro    _GetVol
  21786.  
  21787. Parameter block
  21788.   -->    12    ioCompletion  pointer
  21789.   <--    16    ioResult      word
  21790.   <--    18    ioNamePtr     pointer
  21791.   <--    22    ioVRefNum     word
  21792.  
  21793. PBGetVol returns a pointer to the name of the default volume in ioNamePtr
  21794. (unless ioNamePtr is NIL) and its volume reference number in ioVRefNum. If a default
  21795. directory was set with a previous PBSetVol call, a pointer to its name will be returned
  21796. in ioNamePtr and its working directory reference number in ioVRefNum.
  21797.  
  21798. Result codes    noErr     No error
  21799.                 nsvErr    No default volume
  21800.  
  21801. æKY PBSetVol
  21802. æFp Files.p
  21803. æT FUNCTION
  21804. æD FUNCTION PBSetVol(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21805. æDT myVariable := PBSetVol(paramBlock,async);
  21806. æRI II-105,  IV-132
  21807. æC 
  21808. Trap macro    _SetVol
  21809.  
  21810. Parameter block
  21811.   -->    12    ioCompletion  pointer
  21812.   <--    16    ioResult      word
  21813.   -->    18    ioNamePtr     pointer
  21814.   -->    22    ioVRefNum     word
  21815.  
  21816. PBSetVol sets the default volume to the mounted volume specified by ioNamePtr or
  21817. ioVRefNum. On hierarchical volumes, PBSetVol also sets the root directory as the
  21818. default directory.
  21819.  
  21820. Result codes    noErr     No error
  21821.                 bdNamErr  Bad volume name
  21822.                 nsvErr    No such volume
  21823.                 paramErr  No default volume
  21824.  
  21825. æKY PBFlushVol
  21826. æFp Files.p
  21827. æT FUNCTION
  21828. æD FUNCTION PBFlushVol(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21829. æDT myVariable := PBFlushVol(paramBlock,async);
  21830. æMM
  21831. æRI II-105, IV-133
  21832. æC 
  21833. Trap macro    _FlushVol
  21834.  
  21835. Parameter block
  21836.   -->    12    ioCompletion  pointer
  21837.   <--    16    ioResult      word
  21838.   -->    18    ioNamePtr     pointer
  21839.   -->    22    ioVRefNum     word
  21840.  
  21841. On the volume specified by ioNamePtr or ioVRefNum, PBFlushVol writes descriptive
  21842. information about the volume, the contents of the associated volume buffer, and all
  21843. access path buffers for the volume (if they’ve changed since the last time PBFlushVol
  21844. was called).
  21845.  
  21846. Note:  The date and time of the last modification to the volume are set
  21847.        when the modification is made, not when the volume is flushed.
  21848.  
  21849. Result codes    noErr     No error
  21850.                 bdNamErr  Bad volume name
  21851.                 extFSErr  External file system
  21852.                 ioErr     I/O error
  21853.                 nsDrvErr  No such drive
  21854.                 nsvErr    No such volume
  21855.                 paramErr  No default volume
  21856.  
  21857. æKY PBCreate
  21858. æFp Files.p
  21859. æT FUNCTION
  21860. æD FUNCTION PBCreate(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21861. æDT myVariable := PBCreate(paramBlock,async);
  21862. æRI II-107, IV-145
  21863. æC 
  21864. Trap macro    _Create
  21865.  
  21866. Parameter block
  21867.   -->    12    ioCompletion  pointer
  21868.   <--    16    ioResult      word
  21869.   -->    18    ioNamePtr     pointer
  21870.   -->    22    ioVRefNum     word
  21871.   -->    26    ioFVersNum    byte
  21872.  
  21873. PBCreate creates a new file (both forks) having the name pointed to by ioNamePtr (and
  21874. on flat volumes, the version number ioVersNum) on the volume specified by ioVRefNum.
  21875. The new file is unlocked and empty. The date and time of its creation and last modification
  21876. are set to the current date and time. If the file created isn’t temporary (that is,
  21877. if it will exist after the application terminates), the application should call
  21878. PBSetFInfo (after PBCreate) to fill in the information needed by the Finder.
  21879.  
  21880. Assembly-language note:  If a desk accessory creates a file, it should
  21881.                          always create it in the directory containing the
  21882.                          system folder. The working directory reference
  21883.                          number for this directory is stored in the global
  21884.                          variable BootDrive; you can pass it in ioVRefNum.
  21885.  
  21886. Result codes    noErr      No error
  21887.                 bdNamErr   Bad file name
  21888.                 dupFNErr   Duplicate file name and version
  21889.                 dirFulErr  File directory full
  21890.                 extFSErr   External file system
  21891.                 ioErr      I/O error
  21892.                 nsvErr     No such volume
  21893.                 vLckdErr   Software volume lock
  21894.                 wPrErr     Hardware volume lock
  21895.  
  21896. æKY PBDelete
  21897. æFp Files.p
  21898. æT FUNCTION
  21899. æD FUNCTION PBDelete(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21900. æDT myVariable := PBDelete(paramBlock,async);
  21901. æRI II-119, IV-147
  21902. æC 
  21903. Trap macro    _Delete
  21904.  
  21905. Parameter block
  21906.   -->    12    ioCompletion  pointer
  21907.   <--    16    ioResult      word
  21908.   -->    18    ioNamePtr     pointer
  21909.   -->    22    ioVRefNum     word
  21910.   -->    26    ioFVersNum    byte
  21911.  
  21912. PBDelete removes the closed file having the name pointed to by ioNamePtr (and on flat
  21913. volumes, the version number ioVersNum) from the volume pointed to by ioVRefNum.
  21914. PBHDelete can be used to delete an empty directory as well.
  21915.  
  21916. Note:  This function will delete both forks of the file.
  21917.  
  21918. Result codes    noErr     No error
  21919.                 bdNamErr  Bad file name
  21920.                 extFSErr  External file system
  21921.                 fBsyErr   File busy, directory not empty, or working
  21922.                           directory control block open
  21923.                 fLckdErr  File locked
  21924.                 fnfErr    File not found
  21925.                 nsvErr    No such volume
  21926.                 ioErr     I/O error
  21927.                 vLckdErr  Software volume lock
  21928.                 wPrErr    Hardware volume lock
  21929.  
  21930. æKY PBOpenRF
  21931. æFp Files.p
  21932. æT FUNCTION
  21933. æD FUNCTION PBOpenRF(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21934. æDT myVariable := PBOpenRF(paramBlock,async);
  21935. æMM
  21936. æRT 74
  21937. æRI II-109, IV-137 
  21938. æC 
  21939. Trap macro    _OpenRF
  21940.  
  21941. Parameter block
  21942.   -->    12    ioCompletion  pointer
  21943.   <--    16    ioResult      word
  21944.   -->    18    ioNamePtr     pointer
  21945.   -->    22    ioVRefNum     word
  21946.   <--    24    ioRefNum      word
  21947.   -->    26    ioVersNum     byte
  21948.   -->    27    ioPermssn     byte
  21949.   -->    28    ioMisc        pointer
  21950.  
  21951. PBOpenRF is identical to PBOpen, except that it opens the file’s resource fork instead
  21952. of its data fork.
  21953.  
  21954. Note:  Normally you should access a file’s resource fork through the
  21955.        routines of the Resource Manager rather than the File Manager.
  21956.        PBOpenRF doesn’t read the resource map into memory; it’s really
  21957.        only useful for block-level operations such as copying files.
  21958.  
  21959. Result codes    noErr     No error
  21960.                 bdNamErr  Bad file name
  21961.                 extFSErr  External file system
  21962.                 fnfErr    File not found
  21963.                 ioErr     I/O error
  21964.                 nsvErr    No such volume
  21965.                 opWrErr   File already open for writing
  21966.                 permErr   Attempt to open locked file for writing
  21967.                 tmfoErr   Too many files open
  21968.  
  21969. æKY PBRename
  21970. æFp Files.p
  21971. æT FUNCTION
  21972. æD FUNCTION PBRename(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  21973. æDT myVariable := PBRename(paramBlock,async);
  21974. æRI II-118, IV-153
  21975. æC 
  21976. Trap macro    _Rename
  21977.  
  21978. Parameter block
  21979.   -->    12    ioCompletion  pointer
  21980.   <--    16    ioResult      word
  21981.   -->    18    ioNamePtr     pointer
  21982.   -->    22    ioVRefNum     word
  21983.   -->    26    ioVersNum     byte
  21984.   -->    28    ioMisc        pointer
  21985.  
  21986. Given a pointer to a file name in ioNamePtr (and on flat volumes, a version number in
  21987. ioVersNum), PBRename changes the name of the file to the name pointed to by ioMisc.
  21988. (If the name pointed to by ioNamePtr contains one or more colons, so must the name
  21989. pointed to by ioMisc.) Access paths currently in use aren’t affected. Given a pointer
  21990. to a volume name in ioNamePtr or a volume reference number in ioVRefNum, it changes
  21991. the name of the volume to the name pointed to by ioMisc. If a volume to be renamed is
  21992. specified by its volume reference number, ioNamePtr can be NIL.
  21993.  
  21994. Warning:  If a volume to be renamed is specified by its volume name, be
  21995.           sure that it ends with a colon, or Rename will consider it a
  21996.           file name.
  21997.  
  21998. Result codes    noErr      No error
  21999.                 bdNamErr   Bad file name
  22000.                 dirFulErr  File directory full
  22001.                 dupFNErr   Duplicate file name and version
  22002.                 extFSErr   External file system
  22003.                 fLckdErr   File locked
  22004.                 fnfErr     File not found
  22005.                 fsRnErr    Problem during rename
  22006.                 ioErr      I/O error
  22007.                 nsvErr     No such volume
  22008.                 paramErr   No default volume
  22009.                 vLckdErr   Software volume lock
  22010.                 wPrErr     Hardware volume lock
  22011.  
  22012. æKY PBGetFInfo
  22013. æFp Files.p
  22014. æT FUNCTION
  22015. æD FUNCTION PBGetFInfo(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22016. æDT myVariable := PBGetFInfo(paramBlock,async);
  22017. æRT 24
  22018. æRI II-115, IV-148, N24-1, N68-1
  22019. æC 
  22020. Trap macro    _GetFileInfo
  22021.  
  22022. Parameter block
  22023.   -->    12    ioCompletion  pointer
  22024.   <--    16    ioResult      word
  22025.   <->    18    ioNamePtr     pointer
  22026.   -->    22    ioVRefNum     word
  22027.   <--    24    ioFRefNum     word
  22028.   -->    26    ioFVersNum    byte
  22029.   -->    28    ioFDirIndex   word
  22030.   <--    30    ioFlAttrib    byte
  22031.   <--    31    ioFlVersNum   byte
  22032.   <--    32    ioFlFndrInfo  16 bytes
  22033.   <--    48    ioFlNum       long word
  22034.   <--    52    ioFlStBlk     word
  22035.   <--    54    ioFlLgLen     long word
  22036.   <--    58    ioFlPyLen     long word
  22037.   <--    62    ioFlRStBlk    word
  22038.   <--    64    ioFlRLgLen    long word
  22039.   <--    68    ioFlRPyLen    long word
  22040.   <--    72    ioFlCrDat     long word
  22041.   <--    76    ioFlMdDat     long word
  22042.  
  22043. PBGetFInfo returns information about the specified file. If ioFDirIndex is positive,
  22044. the File Manager returns information about the file whose directory index is ioFDirIndex
  22045. on the volume specified by ioVRefNum. (See the section
  22046. “Data Organization on Volumes” if you’re interested in using this method.)
  22047.  
  22048. Note:  If a working directory reference number is specified in ioVRefNum,
  22049.        the File Manager returns information about the file whose directory
  22050.        index is ioFDirIndex in the specified directory.
  22051.  
  22052. If ioFDirIndex is negative or 0, the File Manager returns information about the file
  22053. having the name pointed to by ioNamePtr (and on flat volumes, the version number
  22054. ioFVersNum) on the volume specified by ioVRefNum. If the file is open, the reference
  22055. number of the first access path found is returned in ioFRefNum, and the name of the
  22056. file is returned in ioNamePtr (unless ioNamePtr is NIL).
  22057.  
  22058. Result codes    noErr     No error
  22059.                 bdNamErr  Bad file name
  22060.                 extFSErr  External file system
  22061.                 fnfErr    File not found
  22062.                 ioErr     I/O error
  22063.                 nsvErr    No such volume
  22064.                 paramErr  No default volume
  22065.  
  22066. æKY PBSetFInfo
  22067. æFp Files.p
  22068. æT FUNCTION
  22069. æD FUNCTION PBSetFInfo(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22070. æDT myVariable := PBSetFInfo(paramBlock,async);
  22071. æRI II-116, IV-150
  22072. æC 
  22073. Trap macro    _SetFileInfo
  22074.  
  22075. Parameter block
  22076.   -->    12    ioCompletion  pointer
  22077.   <--    16    ioResult      word
  22078.   -->    18    ioNamePtr     pointer
  22079.   -->    22    ioVRefNum     word
  22080.   -->    26    ioFVersNum    byte
  22081.   -->    32    ioFlFndrInfo  16 bytes
  22082.   -->    72    ioFlCrDat     long word
  22083.   -->    76    ioFlMdDat     long word
  22084.  
  22085. PBSetFInfo sets information (including the date and time of creation and modification,
  22086. and information needed by the Finder) about the file having the name pointed to by
  22087. ioNamePtr (and on flat volumes, the version number ioFVersNum) on the volume specified
  22088. by ioVRefNum. You should call PBGetFInfo just before PBSetFInfo, so the current
  22089. information is present in the parameter block.
  22090.  
  22091. Result codes    noErr     No error
  22092.                 bdNamErr  Bad file name
  22093.                 extFSErr  External file system
  22094.                 fLckdErr  File locked
  22095.                 fnfErr    File not found
  22096.                 ioErr     I/O error
  22097.                 nsvErr    No such volume
  22098.                 vLckdErr  Software volume lock
  22099.                 wPrErr    Hardware volume lock
  22100.  
  22101. æKY PBSetFLock
  22102. æFp Files.p
  22103. æT FUNCTION
  22104. æD FUNCTION PBSetFLock(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22105. æDT myVariable := PBSetFLock(paramBlock,async);
  22106. æRI II-116, IV-151
  22107. æC 
  22108. Trap macro    _SetFilLock
  22109.  
  22110. Parameter block
  22111.   -->    12    ioCompletion  pointer
  22112.   <--    16    ioResult      word
  22113.   -->    18    ioNamePtr     pointer
  22114.   -->    22    ioVRefNum     word
  22115.   -->    26    ioFVersNum    byte
  22116.  
  22117. PBSetFLock locks the file having the name pointed to by ioNamePtr (and on flat volumes,
  22118. the version number ioFVersNum) on the volume specified by ioVRefNum. Access paths
  22119. currently in use aren’t affected.
  22120.  
  22121. Result codes    noErr     No error
  22122.                 extFSErr  External file system
  22123.                 fnfErr    File not found
  22124.                 ioErr     I/O error
  22125.                 nsvErr    No such volume
  22126.                 vLckdErr  Software volume lock
  22127.                 wPrErr    Hardware volume lock
  22128.  
  22129. æKY PBRstFLock
  22130. æFp Files.p
  22131. æT FUNCTION
  22132. æD FUNCTION PBRstFLock(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22133. æDT myVariable := PBRstFLock(paramBlock,async);
  22134. æRI II-117, IV-152
  22135. æC 
  22136. Trap macro    _RstFilLock
  22137.  
  22138. Parameter block
  22139.   -->    12    ioCompletion  pointer
  22140.   <--    16    ioResult      word
  22141.   -->    18    ioNamePtr     pointer
  22142.   -->    22    ioVRefNum     word
  22143.   -->    26    ioFVersNum    byte
  22144.  
  22145. PBRstFLock unlocks the file having the name pointed to by ioNamePtr (and on flat
  22146. volumes, the version number ioFVersNum) on the volume specified by ioVRefNum. Access
  22147. paths currently in use aren’t affected.
  22148.  
  22149. Result codes    noErr     No error
  22150.                 extFSErr  External file system
  22151.                 fnfErr    File not found
  22152.                 ioErr     I/O error
  22153.                 nsvErr    No such volume
  22154.                 vLckdErr  Software volume lock
  22155.                 wPrErr    Hardware volume lock
  22156.  
  22157. æKY PBSetFVers
  22158. æFp Files.p
  22159. æT FUNCTION
  22160. æD FUNCTION PBSetFVers(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22161. æDT myVariable := PBSetFVers(paramBlock,async);
  22162. æRI II-117, IV-153
  22163. æC 
  22164. Trap macro    _SetFilType
  22165.  
  22166. Parameter block
  22167.   -->    12    ioCompletion  pointer
  22168.   <--    16    ioResult      word
  22169.   -->    18    ioNamePtr     pointer
  22170.   -->    22    ioVRefNum     word
  22171.   -->    26    ioVersNum     byte
  22172.   -->    28    ioMisc        byte
  22173.  
  22174. PBSetFVers has no effect on hierarchical volumes. On flat volumes, PBSetFVers changes
  22175. the version number of the file having the name pointed to by ioNamePtr and version
  22176. number ioVersNum, on the volume specified by ioVRefNum, to the version number stored
  22177. in the high-order byte of ioMisc. Access paths currently in use aren’t affected.
  22178.  
  22179. Result codes    noErr         No error
  22180.                 bdNamErr      Bad file name
  22181.                 dupFNErr      Duplicate file name and version
  22182.                 extFSErr      External file system
  22183.                 fLckdErr      File locked
  22184.                 fnfErr        File not found
  22185.                 nsvErr        No such volume
  22186.                 ioErr         I/O error
  22187.                 paramErr      No default volume
  22188.                 vLckdErr      Software volume lock
  22189.                 wPrErr        Hardware volume lock
  22190.                 wrgVolTypErr  Attempt to perform hierarchical operation
  22191.                               on a flat volume
  22192.     
  22193.  
  22194. æKY PBAllocate
  22195. æFp Files.p
  22196. æT FUNCTION
  22197. æD FUNCTION PBAllocate(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22198. æDT myVariable := PBAllocate(paramBlock,async);
  22199. æRI II-113, IV-143
  22200. æC 
  22201. Trap macro    _Allocate
  22202.  
  22203. Parameter block
  22204.   -->    12    ioCompletion  pointer
  22205.   <--    16    ioResult      word
  22206.   -->    24    ioRefNum      word
  22207.   -->    36    ioReqCount    long word
  22208.   <--    40    ioActCount    long word
  22209.  
  22210. PBAllocate adds ioReqCount bytes to the open file whose access path is specified by
  22211. ioRefNum, and sets the physical end-of-file to one byte beyond the last block allocated.
  22212. The number of bytes actually allocated is rounded up to the nearest multiple of the
  22213. allocation block size, and returned in ioActCount. If there isn’t enough empty space
  22214. on the volume to satisfy the allocation request, PBAllocate allocates the rest of the
  22215. space on the volume and returns dskFulErr as its function result.
  22216.  
  22217. Note:  Even if the total number of requested bytes is unavailable,
  22218.        PBAllocate will allocate whatever space, contiguous or not, is
  22219.        available. To force the allocation of the entire requested space
  22220.        as a contiguous piece, call PBAllocContig instead.
  22221.  
  22222. Result codes    noErr      No error
  22223.                 dskFulErr  Disk full
  22224.                 fLckdErr   File locked
  22225.                 fnOpnErr   File not open
  22226.                 ioErr      I/O error
  22227.                 rfNumErr   Bad reference number
  22228.                 vLckdErr   Software volume lock
  22229.                 wPrErr     Hardware volume lock
  22230.                 wrPermErr  Read/write permission doesn’t allow writing
  22231.  
  22232. æKY PBGetEOF
  22233. æFp Files.p
  22234. æT FUNCTION
  22235. æD FUNCTION PBGetEOF(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22236. æDT myVariable := PBGetEOF(paramBlock,async);
  22237. æRI II-112, IV-142
  22238. æC 
  22239. Trap macro    _GetEOF
  22240.  
  22241. Parameter block
  22242.   -->    12    ioCompletion  pointer
  22243.   <--    16    ioResult      word
  22244.   -->    24    ioRefNum      word
  22245.   <--    28    ioMisc        long word
  22246.  
  22247. PBGetEOF returns, in ioMisc, the logical end-of-file of the open file whose access
  22248. path is specified by ioRefNum.
  22249.  
  22250. Result codes    noErr     No error
  22251.                 extFSErr  External file system
  22252.                 fnOpnErr  File not open
  22253.                 ioErr     I/O error
  22254.                 rfNumErr  Bad reference number
  22255.  
  22256. æKY PBSetEOF
  22257. æFp Files.p
  22258. æT FUNCTION
  22259. æD FUNCTION PBSetEOF(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22260. æDT myVariable := PBSetEOF(paramBlock,async);
  22261. æRI II-112, IV-142
  22262. æC 
  22263. Trap macro    _SetEOF
  22264.  
  22265. Parameter block
  22266.   -->    12    ioCompletion  pointer
  22267.   <--    16    ioResult      word
  22268.   -->    24    ioRefNum      word
  22269.   -->    28    ioMisc        long word
  22270.  
  22271. PBSetEOF sets the logical end-of-file of the open file, whose access path is specified
  22272. by ioRefNum, to ioMisc. If you attempt to set the logical end-of-file beyond the
  22273. physical end-of-file, another allocation block is added to the file; if there isn’t
  22274. enough space on the volume, no change is made, and PBSetEOF returns dskFulErr as its
  22275. function result. If ioMisc is 0, all space occupied by the file on the volume is
  22276. released.
  22277.  
  22278. Result codes    noErr      No error
  22279.                 dskFulErr  Disk full
  22280.                 extFSErr   External file system
  22281.                 fLckdErr   File locked
  22282.                 fnOpnErr   File not open
  22283.                 ioErr      I/O error
  22284.                 rfNumErr   Bad reference number
  22285.                 vLckdErr   Software volume lock
  22286.                 wPrErr     Hardware volume lock
  22287.                 wrPermErr  Read/write permission doesn’t allow writing
  22288.  
  22289. æKY PBGetFPos
  22290. æFp Files.p
  22291. æT FUNCTION
  22292. æD FUNCTION PBGetFPos(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22293. æDT myVariable := PBGetFPos(paramBlock,async);
  22294. æRI II-111, IV-141
  22295. æC 
  22296. Trap macro    _GetFPos
  22297.  
  22298. Parameter block
  22299.   -->    12    ioCompletion  pointer
  22300.   <--    16    ioResult      word
  22301.   -->    24    ioRefNum      word
  22302.   <--    36    ioReqCount    long word
  22303.   <--    40    ioActCount    long word
  22304.   <--    44    ioPosMode     word
  22305.   <--    46    ioPosOffset   long word
  22306.  
  22307. PBGetFPos returns, in ioPosOffset, the mark of the open file whose access path is
  22308. specified by ioRefNum. It sets ioReqCount, ioActCount, and ioPosMode to 0.
  22309.  
  22310. Result codes    noErr     No error
  22311.                 extFSErr  External file system
  22312.                 fnOpnErr  File not open
  22313.                 gfpErr    Error during GetFPos
  22314.                 ioErr     I/O error
  22315.                 rfNumErr  Bad reference number
  22316.  
  22317. æKY PBSetFPos
  22318. æFp Files.p
  22319. æT FUNCTION
  22320. æD FUNCTION PBSetFPos(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22321. æDT myVariable := PBSetFPos(paramBlock,async);
  22322. æRI II-111, IV-141
  22323. æC 
  22324. Trap macro    _SetFPos
  22325.  
  22326. Parameter block
  22327.   -->    12    ioCompletion  pointer
  22328.   <--    16    ioResult      word
  22329.   -->    24    ioRefNum      word
  22330.   -->    44    ioPosMode     word
  22331.   <->    46    ioPosOffset   long word
  22332.  
  22333. PBSetFPos sets the mark of the open file whose access path is specified by ioRefNum
  22334. to the position specified by ioPosMode and ioPosOffset. The position at which the
  22335. mark is actually set is returned in ioPosOffset. If you try to set the mark past the
  22336. logical end-of-file, PBSetFPos moves the mark to the end-of-file and returns eofErr
  22337. as its function result.
  22338.  
  22339. Result codes    noErr     No error
  22340.                 eofErr    End-of-file
  22341.                 extFSErr  External file system
  22342.                 fnOpnErr  File not open
  22343.                 ioErr     I/O error
  22344.                 posErr    Attempt to position before start of file
  22345.                 rfNumErr  Bad reference number
  22346.  
  22347. æKY PBFlushFile
  22348. æFp Files.p
  22349. æT FUNCTION
  22350. æD FUNCTION PBFlushFile(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  22351. æDT myVariable := PBFlushFile(paramBlock,async);
  22352. æRI II-114, IV-144
  22353. æC 
  22354. Trap macro    _FlushFile
  22355.  
  22356. Parameter block
  22357.   -->    12    ioCompletion  pointer
  22358.   <--    16    ioResult      word
  22359.   -->    24    ioRefNum      word
  22360.  
  22361. PBFlushFile writes the contents of the access path buffer indicated by ioRefNum to
  22362. the volume, and updates the file’s entry in the file directory (or in the file catalog,
  22363. in the case of hierarchical volumes).
  22364.  
  22365. Warning:  Some information stored on the volume won’t be correct
  22366.           until PBFlushVol is called.
  22367.  
  22368. Result codes    noErr      No error
  22369.                 extFSErr   External file system
  22370.                 fnfErr     File not found
  22371.                 fnOpnErr   File not open
  22372.                 ioErr      I/O error
  22373.                 nsvErr     No such volume
  22374.                 rfNumErr   Bad reference number
  22375.  
  22376. æKY PBMountVol
  22377. æFp Files.p
  22378. æT FUNCTION
  22379. æD FUNCTION PBMountVol(paramBlock: ParmBlkPtr): OSErr;
  22380. æDT myVariable := PBMountVol(paramBlock);
  22381. æMM
  22382. æRT 134
  22383. æRI II-103, IV-128
  22384. æC 
  22385. »Accessing Volumes
  22386.  
  22387. To get the volume reference number of a volume, given the path reference number of a
  22388. file on that volume, both Pascal and assembly-language programmers can call the
  22389. high-level File Manager function GetVRefNum. Assembly-language programmers may prefer
  22390. calling the function GetFCBInfo (described below in the section “Data Structures in
  22391. Memory”).
  22392.  
  22393. FUNCTION PBMountVol (paramBlock:  ParmBlkPtr) :  OSErr;
  22394.  
  22395. Trap macro    _MountVol
  22396.  
  22397. Parameter block
  22398.   <--    16    ioResult   word
  22399.   <->    22    ioVRefNum  word
  22400.  
  22401. PBMountVol mounts the volume in the drive specified by ioVRefNum, and returns a
  22402. volume reference number in ioVRefNum. If there are no volumes already mounted, this
  22403. volume becomes the default volume. PBMountVol is always executed synchronously.
  22404.  
  22405. Note:  When mounting hierarchical volumes, PBMountVol opens two files
  22406.        needed for maintaining file directory and file mapping information.
  22407.        PBMountVol can fail if there are no access paths available for these
  22408.        two files; it will return tmfoErr as its function result.
  22409.  
  22410. Result codes    noErr        No error
  22411.                 badMDBErr    Bad master directory block
  22412.                 extFSErr     External file system
  22413.                 ioErr        I/O error
  22414.                 memFullErr   Not enough room in heap zone
  22415.                 noMacDskErr  Not a Macintosh disk
  22416.                 nsDrvErr     No such drive
  22417.                 paramErr     Bad drive number
  22418.                 tmfoErr      Too many files open
  22419.                 volOnLinErr  Volume already on-line
  22420.  
  22421. æKY PBUnmountVol
  22422. æFp Files.p
  22423. æT FUNCTION
  22424. æD FUNCTION PBUnmountVol(paramBlock: ParmBlkPtr): OSErr;
  22425. æDT myVariable := PBUnmountVol(paramBlock);
  22426. æRI II-106, IV-134
  22427. æC 
  22428. Trap macro    _UnmountVol
  22429.  
  22430. Parameter block
  22431.   <--    16    ioResult   word
  22432.   -->    18    ioNamePtr  pointer
  22433.   -->    22    ioVRefNum  word
  22434.  
  22435. PBUnmountVol unmounts the volume specified by ioNamePtr or ioVRefNum, by calling
  22436. PBFlushVol to flush the volume, closing all open files on the volume, and releasing
  22437. the memory used for the volume. PBUnmountVol is always executed synchronously.
  22438.  
  22439. Warning:  Don’t unmount the startup volume.
  22440.  
  22441. Note:  Unmounting a volume does not close working directories; to release
  22442.        the memory allocated to a working directory, call PBCloseWD.
  22443.  
  22444. Result codes    noErr     No error
  22445.                 bdNamErr  Bad volume name
  22446.                 extFSErr  External file system
  22447.                 ioErr     I/O error
  22448.                 nsDrvErr  No such drive
  22449.                 nsvErr    No such volume
  22450.                 paramErr  No default volume
  22451.  
  22452. æKY PBEject
  22453. æFp Files.p
  22454. æT FUNCTION
  22455. æD FUNCTION PBEject(paramBlock: ParmBlkPtr): OSErr;
  22456. æDT myVariable := PBEject(paramBlock);
  22457. æMM
  22458. æRI II-107, IV-135
  22459. æC 
  22460. Trap macro    _Eject
  22461.  
  22462. Parameter block
  22463.   -->    12    ioCompletion  pointer
  22464.   <--    16    ioResult      word
  22465.   -->    18    ioNamePtr     pointer
  22466.   -->    22    ioVRefNum     word
  22467.  
  22468. PBEject flushes the volume specified by ioNamePtr or ioVRefNum, places it
  22469. off-line, and then ejects the volume.
  22470.  
  22471. Assembly-language note:  You may invoke the macro _Eject asynchronously;
  22472.                          the first part of the call is executed synchronously,
  22473.                          and the actual ejection is executed asynchronously.
  22474.  
  22475. Result codes    noErr     No error
  22476.                 bdNamErr  Bad volume name
  22477.                 extFSErr  External file system
  22478.                 ioErr     I/O error
  22479.                 nsDrvErr  No such drive
  22480.                 nsvErr    No such volume
  22481.                 paramErr  No default volume
  22482.  
  22483. æKY PBOffLine
  22484. æFp Files.p
  22485. æT FUNCTION
  22486. æD FUNCTION PBOffLine(paramBlock: ParmBlkPtr): OSErr;
  22487. æDT myVariable := PBOffLine(paramBlock);
  22488. æMM
  22489. æRI II-106, IV-134
  22490. æC 
  22491. Trap macro    _OffLine
  22492.  
  22493. Parameter block
  22494.   -->    12    ioCompletion  pointer
  22495.   <--    16    ioResult      word
  22496.   -->    18    ioNamePtr     pointer
  22497.   -->    22    ioVRefNum     word
  22498.  
  22499. PBOffLine places off-line the volume specified by ioNamePtr or ioVRefNum, by calling
  22500. PBFlushVol to flush the volume and releasing all the memory used for the volume
  22501. except for the volume control block. PBOffLine is always executed synchronously.
  22502.  
  22503. Result codes    noErr     No error
  22504.                 bdNamErr  Bad volume name
  22505.                 extFSErr  External file system
  22506.                 ioErr     I/O error
  22507.                 nsDrvErr  No such drive
  22508.                 nsvErr    No such volume
  22509.                 paramErr  No default volume
  22510.  
  22511. æKY AddDrive
  22512. æFp Files.p
  22513. æT PROCEDURE
  22514. æD PROCEDURE AddDrive(drvrRefNum: INTEGER;drvNum: INTEGER;qEl: DrvQElPtr);
  22515. æDT AddDrive(drvrRefNum,drvNum,qEl);
  22516. æRT 36, 108 
  22517. æRI N36, N108-1
  22518. æC 
  22519.  
  22520. æKY FSOpen
  22521. æFp Files.p
  22522. æT FUNCTION
  22523. æD FUNCTION FSOpen(fileName: Str255;vRefNum: INTEGER;VAR refNum: INTEGER): OSErr;
  22524. æDT myVariable := FSOpen(fileName,vRefNum,refNum);
  22525. æRT 102
  22526. æRI II-91, IV-109, P-131, 171
  22527. æC  
  22528. [Not in ROM]
  22529.  
  22530. FSOpen creates an access path to the file having the name fileName on the volume
  22531. specified by vRefNum. A path reference number is returned in refNum. The access
  22532. path’s read/write permission is set to whatever the file’s open permission allows.
  22533.  
  22534. Note:  There’s no guarantee that any bytes have been written until
  22535.        FlushVol is called.
  22536.  
  22537. Result codes    noErr       No error
  22538.                 bdNamErr    Bad file name
  22539.                 extFSErr    External file system
  22540.                 fnfErr      File not found
  22541.                 ioErr       I/O error
  22542.                 nsvErr      No such volume
  22543.                 opWrErr     File already open for writing
  22544.                 tmfoErr     Too many files open
  22545.  
  22546. æKY FSClose
  22547. æFp Files.p
  22548. æT FUNCTION
  22549. æD FUNCTION FSClose(refNum: INTEGER): OSErr;
  22550. æDT myVariable := FSClose(refNum);
  22551. æRT 102
  22552. æRI II-94, IV-112, P-132, 133, 171
  22553. æC  
  22554. [Not in ROM]
  22555.  
  22556. FSClose removes the access path specified by refNum, writes the contents of the
  22557. volume buffer to the volume, and updates the file’s entry in the file directory.
  22558.  
  22559. Note:  There’s no guarantee that any bytes have been written until
  22560.        FlushVol is called.
  22561.  
  22562. Result codes    noErr       No error
  22563.                 extFSErr    External file system
  22564.                 fnfErr      File not found
  22565.                 fnOpnErr    File not open
  22566.                 ioErr       I/O error
  22567.                 nsvErr      No such volume
  22568.                 rfNumErr    Bad reference number
  22569.  
  22570. æKY FSRead
  22571. æFp Files.p
  22572. æT FUNCTION
  22573. æD FUNCTION FSRead(refNum: INTEGER;VAR count: LONGINT;buffPtr: Ptr): OSErr;
  22574. æDT myVariable := FSRead(refNum,count,buffPtr);
  22575. æRI IV-109, P-131, 171
  22576. æC  
  22577. [Not in ROM]
  22578.  
  22579. FSRead attempts to read the number of bytes specified by the count parameter from the
  22580. open file whose access path is specified by refNum, and transfer them to the data
  22581. buffer pointed to by buffPtr. The read operation begins at the current mark, so you
  22582. might want to precede this with a call to SetFPos. If you try to read past the logical
  22583. end-of-file, FSRead moves the mark to the end-of-file and returns eofErr as its
  22584. function result. After the read is completed, the number of bytes actually read is
  22585. returned in the count parameter.
  22586.  
  22587. Result codes    noErr       No error
  22588.                 eofErr      End-of-file
  22589.                 extFSErr    External file system
  22590.                 fnOpnErr    File not open
  22591.                 ioErr       I/O error
  22592.                 paramErr    Negative count
  22593.                 rfNumErr    Bad reference number
  22594.  
  22595. æKY FSWrite
  22596. æFp Files.p
  22597. æT FUNCTION
  22598. æD FUNCTION FSWrite(refNum: INTEGER;VAR count: LONGINT;buffPtr: Ptr): OSErr;
  22599. æDT myVariable := FSWrite(refNum,count,buffPtr);
  22600. æRI IV-110, P-132, 171
  22601. æC  
  22602. [Not in ROM]
  22603.  
  22604. FSWrite takes the number of bytes specified by the count parameter from the buffer
  22605. pointed to by buffPtr and attempts to write them to the open file whose access path
  22606. is specified by refNum. The write operation begins at the current mark, so you might
  22607. want to precede this with a call to SetFPos. After the write is completed, the number
  22608. of bytes actually written is returned in the count parameter.
  22609.  
  22610. Result codes    noErr        No error
  22611.                 dskFulErr    Disk full
  22612.                 fLckdErr     File locked
  22613.                 fnOpnErr     File not open
  22614.                 ioErr        I/O error
  22615.                 paramErr     Negative count
  22616.                 rfNumErr     Bad reference number
  22617.                 vLckdErr     Software volume lock
  22618.                 wPrErr       Hardware volume lock
  22619.                 wrPermErr    Read/write permission doesn’t allow writing
  22620.  
  22621. æKY GetVInfo
  22622. æFp Files.p
  22623. æT FUNCTION
  22624. æD FUNCTION GetVInfo(drvNum: INTEGER;volName: StringPtr;VAR vRefNum: INTEGER;
  22625.     VAR freeBytes: LONGINT): OSErr;
  22626. æDT myVariable := GetVInfo(drvNum,volName,vRefNum,freeBytes);
  22627. æRT 157
  22628. æRI II-89, IV-107, N157, low-level  II-104, IV-129
  22629. æC 
  22630. »Accessing Volumes
  22631.  
  22632. •••Refer to Technical Note #24:•••
  22633.  
  22634. FUNCTION GetVInfo (drvNum:  INTEGER; volName:  StringPtr; VAR vRefNum:  INTEGER;
  22635.                    VAR freeBytes:  LONGINT) :  OSErr; [Not in ROM]
  22636.  
  22637. •••Refer to Technical Note #157:•••
  22638.  
  22639. GetVInfo returns the name, reference number, and available space (in bytes), in
  22640. volName, vRefNum, and freeBytes, for the volume in the drive specified by drvNum.
  22641.  
  22642. Result codes    noErr       No error
  22643.                 nsvErr      No default volume
  22644.                 paramErr    Bad drive number
  22645.  
  22646. æKY GetFInfo
  22647. æFp Files.p
  22648. æT FUNCTION
  22649. æD FUNCTION GetFInfo(fileName: Str255;vRefNum: INTEGER;VAR fndrInfo: FInfo): OSErr;
  22650. æDT myVariable := GetFInfo(fileName,vRefNum,fndrInfo);
  22651. æRI II-95, IV-113
  22652. æC  
  22653. [Not in ROM]
  22654.  
  22655. For the file having the name fileName on the specified volume, GetFInfo returns
  22656. information used by the Finder in fndrInfo (see the section “Information Used by the
  22657. Finder”).
  22658.  
  22659. Result codes    noErr       No error
  22660.                 bdNamErr    Bad file name
  22661.                 extFSErr    External file system
  22662.                 fnfErr      File not found
  22663.                 ioErr       I/O error
  22664.                 nsvErr      No such volume
  22665.                 paramErr    No default volume
  22666.  
  22667. æKY GetVol
  22668. æFp Files.p
  22669. æT FUNCTION
  22670. æD FUNCTION GetVol(volName: StringPtr;VAR vRefNum: INTEGER): OSErr;
  22671. æDT myVariable := GetVol(volName,vRefNum);
  22672. æRT 77,140
  22673. æRI N77-2, N140 high-level  II-89, IV-107  low-level  II-104, IV-131
  22674. æC  
  22675. [Not in ROM]
  22676.  
  22677. GetVol returns the name of the default volume in volName and its volume reference
  22678. number in vRefNum.
  22679.  
  22680. Result codes    noErr     No error
  22681.                 nsvErr    No such volume
  22682.  
  22683. æKY SetVol
  22684. æFp Files.p
  22685. æT FUNCTION
  22686. æD FUNCTION SetVol(volName: StringPtr;vRefNum: INTEGER): OSErr;
  22687. æDT myVariable := SetVol(volName,vRefNum);
  22688. æRI II-89, IV-107  low-level II-105, IV-132
  22689. æC  
  22690. [Not in ROM]
  22691.  
  22692. SetVol sets the default volume to the mounted volume specified by volName or vRefNum.
  22693.  
  22694. Result codes    noErr       No error
  22695.                 bdNamErr    Bad volume name
  22696.                 nsvErr      No such volume
  22697.                 paramErr    No default volume
  22698.  
  22699. æKY UnmountVol
  22700. æFp Files.p
  22701. æT FUNCTION
  22702. æD FUNCTION UnmountVol(volName: StringPtr;vRefNum: INTEGER): OSErr;
  22703. æDT myVariable := UnmountVol(volName,vRefNum);
  22704. æRT 180
  22705. æRI II-90, IV-108  low-level II-106, IV-134
  22706. æC  
  22707. [Not in ROM]
  22708.  
  22709. UnmountVol unmounts the volume specified by volName or vRefNum, by calling FlushVol
  22710. to flush the volume buffer, closing all open files on the volume, and releasing the
  22711. memory used for the volume.
  22712.  
  22713. Warning:  Don’t unmount the startup volume.
  22714.  
  22715. Result codes    noErr        No error
  22716.                 bdNamErr     Bad volume name
  22717.                 extFSErr     External file system
  22718.                 ioErr        I/O error
  22719.                 nsDrvErr     No such drive
  22720.                 nsvErr       No such volume
  22721.                 paramErr     No default volume
  22722.  
  22723. æKY Eject
  22724. æFp Files.p
  22725. æT FUNCTION
  22726. æD FUNCTION Eject(volName: StringPtr;vRefNum: INTEGER): OSErr;
  22727. æDT myVariable := Eject(volName,vRefNum);
  22728. æMM
  22729. æRI II-90, IV-108 low-level  II-107, IV-135
  22730. æC  
  22731. [Not in ROM]
  22732.  
  22733. Eject flushes the volume specified by volName or vRefNum, places it off-line, and
  22734. then ejects the volume.
  22735.  
  22736. Result codes    noErr       No error
  22737.                 bdNamErr    Bad volume name
  22738.                 extFSErr    External file system
  22739.                 ioErr       I/O error
  22740.                 nsDrvErr    No such drive
  22741.                 nsvErr      No such volume
  22742.                 paramErr    No default volume
  22743. paramErr    No default volume
  22744.  
  22745. æKY FlushVol
  22746. æFp Files.p
  22747. æT FUNCTION
  22748. æD FUNCTION FlushVol(volName: StringPtr;vRefNum: INTEGER): OSErr;
  22749. æDT myVariable := FlushVol(volName,vRefNum);
  22750. æMM
  22751. æRI P-132, 133 high-level  II-89, IV-108 low-level  II-105, IV-133
  22752. æC  
  22753. [Not in ROM]
  22754.  
  22755. On the volume specified by volName or vRefNum, FlushVol writes the contents of the
  22756. associated volume buffer and descriptive information about the volume (if they’ve
  22757. changed since the last time FlushVol was called).
  22758.  
  22759. Result codes    noErr       No error
  22760.                 bdNamErr    Bad volume name
  22761.                 extFSErr    External file system
  22762.                 ioErr       I/O error
  22763.                 nsDrvErr    No such drive
  22764.                 nsvErr      No such volume
  22765.                 paramErr    No default volume
  22766.  
  22767. æKY Create
  22768. æFp Files.p
  22769. æT FUNCTION
  22770. æD FUNCTION Create(fileName: Str255;vRefNum: INTEGER;creator: OSType;fileType: OSType): OSErr;
  22771. æDT myVariable := Create(fileName,vRefNum,creator,fileType);
  22772. æRI II-90, IV-112 low-level II-107, IV-145
  22773. æC  
  22774. [Not in ROM]
  22775.  
  22776. Create creates a new file (both forks) with the specified name, file type, and creator
  22777. on the specified volume. (File type and creator are discussed in the Finder Interface
  22778. chapter.) The new file is unlocked and empty. The date and time of its creation and
  22779. last modification are set to the current date and time.
  22780.  
  22781. Result codes    noErr        No error
  22782.                 bdNamErr     Bad file name
  22783.                 dupFNErr     Duplicate file name and version
  22784.                 dirFulErr    File directory full
  22785.                 extFSErr     External file system
  22786.                 ioErr        I/O error
  22787.                 nsvErr       No such volume
  22788.                 vLckdErr     Software volume lock
  22789.                 wPrErr       Hardware volume lock
  22790.  
  22791. æKY FSDelete
  22792. æFp Files.p
  22793. æT FUNCTION
  22794. æD FUNCTION FSDelete(fileName: Str255;vRefNum: INTEGER): OSErr;
  22795. æDT myVariable := FSDelete(fileName,vRefNum);
  22796. æRI II-97, IV-113
  22797. æC 
  22798. [Not in ROM]
  22799.  
  22800. FSDelete removes the closed file having the name fileName from the specified volume.
  22801.  
  22802. Note:  This function will delete both forks of a file.
  22803.  
  22804. Result codes    noErr       No error
  22805.                 bdNamErr    Bad file name
  22806.                 extFSErr    External file system
  22807.                 fBsyErr     File busy
  22808.                 fLckdErr    File locked
  22809.                 fnfErr      File not found
  22810.                 ioErr       I/O error
  22811.                 nsvErr      No such volume
  22812.                 vLckdErr    Software volume lock
  22813.                 wPrErr      Hardware volume lock
  22814.  
  22815. æKY OpenRF
  22816. æFp Files.p
  22817. æT FUNCTION
  22818. æD FUNCTION OpenRF(fileName: Str255;vRefNum: INTEGER;VAR refNum: INTEGER): OSErr;
  22819. æDT myVariable := OpenRF(fileName,vRefNum,refNum);
  22820. æRT 74
  22821. æRI II-91, IV-109 low-level II-109, IV-137
  22822. æC  
  22823. [Not in ROM]
  22824.  
  22825. OpenRF is similar to FSOpen; the only difference is that OpenRF opens the resource
  22826. fork of the specified file rather than the data fork. A path reference number is
  22827. returned in refNum. The access path’s read/write permission is set to whatever the
  22828. file’s open permission allows.
  22829.  
  22830. Note:  Normally you should access a file’s resource fork through the
  22831.        routines of the Resource Manager rather than the File Manager.
  22832.        OpenRF doesn’t read the resource map into memory; it’s really
  22833.        only useful for block-level operations such as copying files.
  22834.  
  22835. Result codes    noErr       No error
  22836.                 bdNamErr    Bad file name
  22837.                 extFSErr    External file system
  22838.                 fnfErr      File not found
  22839.                 ioErr       I/O error
  22840.                 nsvErr      No such volume
  22841.                 opWrErr     File already open for writing
  22842.                 tmfoErr     Too many files open
  22843.  
  22844. æKY Rename
  22845. æFp Files.p
  22846. æT FUNCTION
  22847. æD FUNCTION Rename(oldName: Str255;vRefNum: INTEGER;newName: Str255): OSErr;
  22848. æDT myVariable := Rename(oldName,vRefNum,newName);
  22849. æRI II-96, IV-114  low-level II-118, IV-153
  22850. æC  
  22851. [Not in ROM]
  22852.  
  22853. Given a file name in oldName, Rename changes the name of the file to newName. Access
  22854. paths currently in use aren’t affected. Given a volume name in oldName or a volume
  22855. reference number in vRefNum, Rename changes the name of the specified volume to
  22856. newName.
  22857.  
  22858. Warning:  If you’re renaming a volume, be sure that both names end with a colon.
  22859.  
  22860. Result codes    noErr        No error
  22861.                 bdNamErr     Bad file name
  22862.                 dirFulErr    Directory full
  22863.                 dupFNErr     Duplicate file name
  22864.                 extFSErr     External file system
  22865.                 fLckdErr     File locked
  22866.                 fnfErr       File not found
  22867.                 fsRnErr      Problem during rename
  22868.                 ioErr        I/O error
  22869.                 nsvErr       No such volume
  22870.                 paramErr     No default volume
  22871.                 vLckdErr     Software volume lock
  22872.                 wPrErr       Hardware volume lock
  22873.  
  22874. æKY SetFInfo
  22875. æFp Files.p
  22876. æT FUNCTION
  22877. æD FUNCTION SetFInfo(fileName: Str255;vRefNum: INTEGER;fndrInfo: FInfo): OSErr;
  22878. æDT myVariable := SetFInfo(fileName,vRefNum,fndrInfo);
  22879. æRI II-95, IV-114
  22880. æC  
  22881. [Not in ROM]
  22882.  
  22883. For the file having the name fileName on the specified volume, SetFInfo sets information
  22884. used by the Finder to fndrInfo (see the section “Information Used by the Finder”).
  22885.  
  22886. Result codes    noErr        No error
  22887.                 extFSErr     External file system
  22888.                 fLckdErr     File locked
  22889.                 fnfErr       File not found
  22890.                 ioErr        I/O error
  22891.                 nsvErr       No such volume
  22892.                 vLckdErr     Software volume lock
  22893.                 wPrErr       Hardware volume lock
  22894.  
  22895. æKY SetFLock
  22896. æFp Files.p
  22897. æT FUNCTION
  22898. æD FUNCTION SetFLock(fileName: Str255;vRefNum: INTEGER): OSErr;
  22899. æDT myVariable := SetFLock(fileName,vRefNum);
  22900. æRI II-95, IV-114
  22901. æC  
  22902. [Not in ROM]
  22903.  
  22904. SetFLock locks the file having the name fileName on the specified volume. Access
  22905. paths currently in use aren’t affected.
  22906.  
  22907. Result codes    noErr       No error
  22908.                 extFSErr    External file system
  22909.                 fnfErr      File not found
  22910.                 ioErr       I/O error
  22911.                 nsvErr      No such volume
  22912.                 vLckdErr    Software volume lock
  22913.                 wPrErr      Hardware volume lock
  22914.  
  22915. æKY RstFLock
  22916. æFp Files.p
  22917. æT FUNCTION
  22918. æD FUNCTION RstFLock(fileName: Str255;vRefNum: INTEGER): OSErr;
  22919. æDT myVariable := RstFLock(fileName,vRefNum);
  22920. æRI II-96, IV-114
  22921. æC 
  22922. [Not in ROM]
  22923.  
  22924. RstFLock unlocks the file having the name fileName on the specified volume. Access
  22925. paths currently in use aren’t affected.
  22926.  
  22927. Result codes    noErr       No error
  22928.                 extFSErr    External file system
  22929.                 fnfErr      File not found
  22930.                 ioErr       I/O error
  22931.                 nsvErr      No such volume
  22932.                 vLckdErr    Software volume lock
  22933.                 wPrErr      Hardware volume lock
  22934.  
  22935. æKY Allocate
  22936. æFp Files.p
  22937. æT FUNCTION
  22938. æD FUNCTION Allocate(refNum: INTEGER;VAR count: LONGINT): OSErr;
  22939. æDT myVariable := Allocate(refNum,count);
  22940. æRI IV-143
  22941. æC  
  22942. [Not in ROM]
  22943.  
  22944. Allocate adds the number of bytes specified by the count parameter to the open file
  22945. whose access path is specified by refNum, and sets the physical end-of-file to one
  22946. byte beyond the last block allocated. The number of bytes actually allocated is
  22947. rounded up to the nearest multiple of the allocation block size, and returned in the
  22948. count parameter. If there isn’t enough empty space on the volume to satisfy the
  22949. allocation request, Allocate allocates the rest of the space on the volume and returns
  22950. dskFulErr as its function result.
  22951.  
  22952. Result codes    noErr        No error
  22953.                 dskFulErr    Disk full
  22954.                 fLckdErr     File locked
  22955.                 fnOpnErr     File not open
  22956.                 ioErr        I/O error
  22957.                 rfNumErr     Bad reference number
  22958.                 vLckdErr     Software volume lock
  22959.                 wPrErr       Hardware volume lock
  22960.                 wrPermErr    Read/write permission doesn’t allow writing
  22961.  
  22962. æKY GetEOF
  22963. æFp Files.p
  22964. æT FUNCTION
  22965. æD FUNCTION GetEOF(refNum: INTEGER;VAR logEOF: LONGINT): OSErr;
  22966. æDT myVariable := GetEOF(refNum,logEOF);
  22967. æRI P-132, 172  high-level  II-93, IV-111 low-level  II-112, IV-142
  22968. æC  
  22969. [Not in ROM]
  22970.  
  22971. GetEOF returns, in logEOF, the logical end-of-file of the open file whose access path
  22972. is specified by refNum.
  22973.  
  22974. Result codes    noErr       No error
  22975.                 extFSErr    External file system
  22976.                 fnOpnErr    File not open
  22977.                 ioErr       I/O error
  22978.                 rfNumErr    Bad reference number
  22979.  
  22980. æKY SetEOF
  22981. æFp Files.p
  22982. æT FUNCTION
  22983. æD FUNCTION SetEOF(refNum: INTEGER;logEOF: LONGINT): OSErr;
  22984. æDT myVariable := SetEOF(refNum,logEOF);
  22985. æRI P-132, 180 high-level II-93, IV-111  low-level II-112, IV-142
  22986. æC  
  22987. [Not in ROM]
  22988.  
  22989. SetEOF sets the logical end-of-file of the open file whose access path is specified
  22990. by refNum to the position specified by logEOF. If you attempt to set the logical
  22991. end-of-file beyond the physical end-of-file, the physical end-of-file is set to one
  22992. byte beyond the end of the next free allocation block; if there isn’t enough space on
  22993. the volume, no change is made, and SetEOF returns dskFulErr as its function result.
  22994. If logEOF is 0, all space occupied by the file on the volume is released.
  22995.  
  22996. Result codes    noErr        No error
  22997.                 dskFulErr    Disk full
  22998.                 extFSErr     External file system
  22999.                 fLckdErr     File locked
  23000.                 fnOpnErr     File not open
  23001.                 ioErr        I/O error
  23002.                 rfNumErr     Bad reference number
  23003.                 vLckdErr     Software volume lock
  23004.                 wPrErr       Hardware volume lock
  23005.                 wrPermErr    Read/write permission doesn’t allow writing
  23006.  
  23007. æKY GetFPos
  23008. æFp Files.p
  23009. æT FUNCTION
  23010. æD FUNCTION GetFPos(refNum: INTEGER;VAR filePos: LONGINT): OSErr;
  23011. æDT myVariable := GetFPos(refNum,filePos);
  23012. æRI II-92, IV-110  low-level  II-111, IV-141
  23013. æC  
  23014. [Not in ROM]
  23015.  
  23016. GetFPos returns, in filePos, the mark of the open file whose access path is specified
  23017. by refNum.
  23018.  
  23019. Result codes    noErr        No error
  23020.                 extFSErr     External file system
  23021.                 fnOpnErr     File not open
  23022.                 ioErr        I/O error
  23023.                 rfNumErr     Bad reference number
  23024.  
  23025. æKY SetFPos
  23026. æFp Files.p
  23027. æT FUNCTION
  23028. æD FUNCTION SetFPos(refNum: INTEGER;posMode: INTEGER;posOff: LONGINT): OSErr;
  23029. æDT myVariable := SetFPos(refNum,posMode,posOff);
  23030. æRI P-131, 132, 180  high-level II-93, IV-110 low-level II-111, IV-141
  23031. æC  
  23032. [Not in ROM]
  23033.  
  23034. SetFPos sets the mark of the open file whose access path is specified by refNum to
  23035. the position specified by posMode and posOff (except when posMode is equal to fsAtMark,
  23036. in which case posOff is ignored). PosMode indicates how to position the mark; it must
  23037. contain one of the following values:
  23038.  
  23039. CONST  fsAtMark     = 0;    {at current mark}
  23040.        fsFromStart  = 1;    {set mark relative to beginning of file}
  23041.        fsFromLEOF   = 2;    {set mark relative to logical end-of-file}
  23042.        fsFromMark   = 3;    {set mark relative to current mark}
  23043.  
  23044. If you specify fsAtMark, posOffset is ignored and the mark is left wherever
  23045. it’s currently positioned. If you choose to set the mark (relative to either the
  23046. beginning of the file, the logical end-of-file, or the current mark), posOffset
  23047. specifies the byte offset from the chosen point (either positive or negative) where
  23048. the mark should be set. If you try to set the mark past the logical end-of-file,
  23049. SetFPos moves the mark to the end-of-file and returns eofErr as its function result.
  23050.  
  23051. Result codes    noErr        No error
  23052.                 eofErr       End-of-file
  23053.                 extFSErr     External file system
  23054.                 fnOpnErr     File not open
  23055.                 ioErr        I/O error
  23056.                 posErr       Attempt to position before start of file
  23057.                 rfNumErr     Bad reference number
  23058.  
  23059. æKY GetVRefNum
  23060. æFp Files.p
  23061. æT FUNCTION
  23062. æD FUNCTION GetVRefNum(fileRefNum: INTEGER;VAR vRefNum: INTEGER): OSErr;
  23063. æDT myVariable := GetVRefNum(fileRefNum,vRefNum);
  23064. æRI II-89, IV-107
  23065. æC  
  23066. [Not in ROM]
  23067.  
  23068. Given a path reference number in pathRefNum, GetVRefNum returns the volume reference
  23069. number in vRefNum.
  23070.  
  23071. Result codes    noErr       No error
  23072.                 rfNumErr    Bad reference number
  23073.  
  23074. æKY PBOpenDF
  23075. æFp Files.p
  23076. æT FUNCTION
  23077. æD FUNCTION PBOpenDF(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  23078. æDT myVariable := PBOpenDF(paramBlock,async);
  23079. æRI VI
  23080. æC 
  23081. OpenDF creates an access path to the data fork of a file. It is almost identical
  23082. to PBFSOpen, which is documented in the File Manager chapter of Volume IV. The
  23083. difference is that PBFSOpen can open both files and devices, but PBOpenDF can
  23084. open only files. Using OpenDF instead of FSOpen when your application is opening
  23085. a file prevents naming conflicts or ambiguities.
  23086.  
  23087. æKY PBOpenWD
  23088. æFp Files.p
  23089. æT FUNCTION
  23090. æD FUNCTION PBOpenWD(paramBlock: WDPBPtr;async: BOOLEAN): OSErr;
  23091. æDT myVariable := PBOpenWD(paramBlock,async);
  23092. æRT 77, 190
  23093. æRI IV-158, N77-1
  23094. æC 
  23095. Trap macro    _OpenWD
  23096.  
  23097. Parameter block
  23098.   -->    12    ioCompletion  pointer
  23099.   <--    16    ioResult      word
  23100.   -->    18    ioNamePtr     pointer
  23101.   <->    22    ioVRefNum     word
  23102.   -->    28    ioWDProcID    long word
  23103.   -->    48    ioWDDirID     long word
  23104.  
  23105. PBOpenWD takes the directory specified by ioVRefNum, ioWDDirID, and ioWDProcID and
  23106. makes it a working directory. (You can also specify the directory using a combination
  23107. of partial pathname and directory ID.) It returns a working directory reference
  23108. number in ioVRefNum that can be used in subsequent calls.
  23109.  
  23110. If a given directory has already been made a working directory using the same ioWDProcID,
  23111. no new working directory will be opened; instead, the existing working directory
  23112. reference number will be returned. If a given directory was already made a working
  23113. directory using a different ioWDProcID, a new working directory reference number is
  23114. returned.
  23115.  
  23116. Result codes    noErr       No error
  23117.                 tmwdoErr    Too many working directories open
  23118.  
  23119. æKY PBCloseWD
  23120. æFp Files.p
  23121. æT FUNCTION
  23122. æD FUNCTION PBCloseWD(paramBlock: WDPBPtr;async: BOOLEAN): OSErr;
  23123. æDT myVariable := PBCloseWD(paramBlock,async);
  23124. æRI IV-158      
  23125. æC 
  23126. Trap macro    _CloseWD
  23127.  
  23128. Parameter block
  23129.   -->    12    ioCompletion  pointer
  23130.   <--    16    ioResult      word
  23131.   -->    22    ioVRefNum     word
  23132.  
  23133. PBCloseWD releases the working directory whose working directory reference number is
  23134. specified in ioVRefNum.
  23135.  
  23136. Note:  If a volume reference number is specified in ioVRefNum, PBCloseWD
  23137.        does nothing.
  23138.  
  23139. Result codes    noErr     No error
  23140.                 nsvErr    No such volume
  23141.  
  23142. æKY PBHSetVol
  23143. æFp Files.p
  23144. æT FUNCTION
  23145. æD FUNCTION PBHSetVol(paramBlock: WDPBPtr;async: BOOLEAN): OSErr;
  23146. æDT myVariable := PBHSetVol(paramBlock,async);
  23147. æRT 140
  23148. æRI IV-133, N140
  23149. æC 
  23150. •••Refer to Technical Note #140:•••
  23151.  
  23152. Trap macro    _HSetVol
  23153.  
  23154. Parameter block
  23155.   -->    12    ioCompletion  pointer
  23156.   <--    16    ioResult      word
  23157.   -->    18    ioNamePtr     pointer
  23158.   -->    22    ioVRefNum     word
  23159.   -->    48    ioWDDirID     long word
  23160.  
  23161. PBHSetVol sets both the default volume and the default directory. The default directory
  23162. to be used can be specified by either a volume reference number or a working directory
  23163. reference number in ioVRefNum, a directory ID in ioWDDirID, or a pointer to a pathname
  23164. (possibly NIL) in ioNamePtr.
  23165.  
  23166. Note:  Both the default volume and the default directory are used in
  23167.        calls made with no volume name and a volume reference number of zero.
  23168.  
  23169. Result codes    noErr     No error
  23170.                 nsvErr    No default volume
  23171.  
  23172. æKY PBHGetVol
  23173. æFp Files.p
  23174. æT FUNCTION
  23175. æD FUNCTION PBHGetVol(paramBlock: WDPBPtr;async: BOOLEAN): OSErr;
  23176. { Trap macro  _HGetVol
  23177.  
  23178. Parameter block
  23179.     —>  12  ioCompletion    pointer
  23180.     <—  16  ioResult        word
  23181.     <—  18  ioNamePtr       pointer
  23182.     <—  22  ioVRefNum       word
  23183.     <—  28  ioWDProcID      long word
  23184.     <—  32  ioWDVRefNum     word
  23185.     <—  48  ioWDDirID       long word
  23186.  
  23187.     PBHGetVol returns the default volume and directory last set by
  23188. either a PBSetVol or a PBHSetVol call. The reference number of the
  23189. default volume is returned in ioVRefNum.
  23190.  
  23191. Warning:  IOVRefNum will return a working directory reference number
  23192.           (instead of the volume reference number) if, in the last call
  23193.           to PBSetVol or PBHSetVol, a working directory reference number
  23194.           was passed in this field.
  23195.  
  23196.     The volume reference number of the volume on which the default
  23197. directory exists is returned in ioWDVRefNum. The directory ID of the
  23198. default directory is returned in ioWDDirID.
  23199.  
  23200. Result codes    noErr   No error
  23201.                 nsvErr  No default volume
  23202.  }
  23203. æDT myVariable := PBHGetVol(paramBlock,async);
  23204. æRI IV-132 
  23205. æC 
  23206. Trap macro    _HGetVol
  23207.  
  23208. Parameter block
  23209.   -->    12    ioCompletion  pointer
  23210.   <--    16    ioResult      word
  23211.   <--    18    ioNamePtr     pointer
  23212.   <--    22    ioVRefNum     word
  23213.   <--    28    ioWDProcID    long word
  23214.   <--    32    ioWDVRefNum   word
  23215.   <--    48    ioWDDirID     long word
  23216.  
  23217. PBHGetVol returns the default volume and directory last set by either a PBSetVol or a
  23218. PBHSetVol call. The reference number of the default volume is returned in ioVRefNum.
  23219.  
  23220. Warning:  IOVRefNum will return a working directory reference number
  23221.           (instead of the volume reference number) if, in the last call
  23222.           to PBSetVol or PBHSetVol, a working directory reference number
  23223.           was passed in this field.
  23224.  
  23225. The volume reference number of the volume on which the default directory exists is
  23226. returned in ioWDVRefNum. The directory ID of the default directory is returned in
  23227. ioWDDirID.
  23228.  
  23229. Result codes    noErr     No error
  23230.                 nsvErr    No default volume
  23231.  
  23232. æKY PBCatMove
  23233. æFp Files.p
  23234. æT FUNCTION
  23235. æD FUNCTION PBCatMove(paramBlock: CMovePBPtr;async: BOOLEAN): OSErr;
  23236. æDT myVariable := PBCatMove(paramBlock,async);
  23237. æRI IV-157, VI
  23238. æC 
  23239. Some existing HFS functions now support file IDs as appropriate, but their
  23240. interface remains stable. This section describes how they accommodate file IDs.
  23241.  
  23242. FUNCTION PBCatMove (paramBlock: HParamBlkPtr, async: Boolean) : OSErr;
  23243.  
  23244. If a file ID exists for the file being moved, the file ID remains with the file.
  23245.  
  23246.  
  23247. •••Refer to Technical Note #226:•••
  23248.  
  23249. Trap macro    _CatMove
  23250.  
  23251. Parameter block
  23252.   -->    12    ioCompletion  pointer
  23253.   <--    16    ioResult      word
  23254.   -->    18    ioNamePtr     pointer
  23255.   -->    22    ioVRefNum     word
  23256.   -->    28    ioNewName     pointer
  23257.   -->    36    ioNewDirID    long word
  23258.   -->    48    ioDirID       long word
  23259.  
  23260. PBCatMove moves files or directories from one directory to another. The name of the
  23261. file or directory to be moved is pointed to by ioNamePtr; ioVRefNum contains either
  23262. the volume reference number or working directory reference number. A directory ID can
  23263. be specified in ioDirID. The name and directory ID of the directory to which the file
  23264. or directory is to be moved are specified by ioNewName and ioNewDirID.
  23265.  
  23266. PBCatMove is strictly a file catalog operation; it does not actually change the
  23267. location of the file or directory on the disk. PBCatMove cannot move a file or directory
  23268. to another volume (that is, ioVRefNum is used in specifying both the source and the
  23269. destination). It also cannot be used to rename files or directories; for that, use
  23270. PBHRename.
  23271.  
  23272. Result codes    noErr      No error
  23273.                 badMovErr  Attempt to move into offspring
  23274.                 bdNamErr   Bad file name or attempt to move into a file
  23275.                 dupFNErr   Duplicate file name and version
  23276.                 fnfErr     File not found
  23277.                 ioErr      I/O error
  23278.                 nsvErr     No such volume
  23279.                 paramErr   No default volume
  23280.                 vLckdErr   Software volume lock
  23281.                 wPrErr     Hardware volume lock
  23282.  
  23283. æKY PBDirCreate
  23284. æFp Files.p
  23285. æT FUNCTION
  23286. æD FUNCTION PBDirCreate(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23287. æDT myVariable := PBDirCreate(paramBlock,async);
  23288. æRI IV-146
  23289. æC 
  23290. Trap macro    _DirCreate
  23291.  
  23292. Parameter block
  23293.   -->    12    ioCompletion  pointer
  23294.   <--    16    ioResult      word
  23295.   <->    18    ioNamePtr     pointer
  23296.   -->    22    ioVRefNum     word
  23297.   <->    48    ioDirID       long word
  23298.  
  23299. PBDirCreate is identical to PBHCreate except that it creates a new directory instead
  23300. of a file. You can specify the parent of the directory to be created in ioDirID; if
  23301. it’s 0, the new directory will be placed in the root directory. The directory ID of
  23302. the new directory is returned in ioDirID.
  23303.  
  23304. Warning:  PBDirCreate operates only with the hierarchical version of
  23305.           the File Manager; if used on a Macintosh equipped only with
  23306.           the 64K ROM version of the File Manager, it will generate a
  23307.           system error.
  23308.  
  23309. Result codes    noErr      No error
  23310.                 bdNamErr   Bad file name
  23311.                 dupFNErr   Duplicate file name and version
  23312.                 dirFulErr  File directory full
  23313.                 dirNFErr   Directory not found or incomplete pathname
  23314.                 extFSErr   External file system
  23315.                 ioErr      I/O error
  23316.                 nsvErr     No such volume
  23317.                 vLckdErr   Software volume lock
  23318.                 wPrErr     Hardware volume lock
  23319.     
  23320.  
  23321. æKY PBGetWDInfo
  23322. æFp Files.p
  23323. æT FUNCTION
  23324. æD FUNCTION PBGetWDInfo(paramBlock: WDPBPtr;async: BOOLEAN): OSErr;
  23325. æDT myVariable := PBGetWDInfo(paramBlock,async);
  23326. æRT 77, 190
  23327. æRI IV-159, N77-5
  23328. æC 
  23329. Trap macro    _GetWDInfo
  23330.  
  23331. Parameter block
  23332.   -->    12    ioCompletion  pointer
  23333.   <--    16    ioResult      word
  23334.   <--    18    ioNamePtr     pointer
  23335.   <->    22    ioVRefNum     word
  23336.   -->    26    ioWDIndex     word
  23337.   <->    28    ioWDProcID    long word
  23338.   <->    32    ioWDVRefNum   word
  23339.   <--    48    ioWDDirID     long word
  23340.  
  23341. PBGetWDInfo returns information about the specified working directory. The working
  23342. directory can be specified either by its working directory reference number in ioVRefNum
  23343. (in which case ioWDIndex should be 0), or by its index number in ioWDIndex. In the
  23344. latter case, if ioVRefNum is nonzero, it’s interpreted as a volume specification
  23345. (volume reference number or drive number), and only working directories on that
  23346. volume are indexed.
  23347.  
  23348. IOWDVRefNum always returns the volume reference number. IOVRefNum returns a working
  23349. directory reference number when a working directory reference number is passed in
  23350. that field; otherwise, it returns a volume reference number. The volume name is
  23351. returned in ioNamePtr.
  23352.  
  23353. If IOWDProcID is nonzero, only working directories with that identifier are indexed;
  23354. otherwise all working directories are indexed.
  23355.  
  23356. Result codes    noErr     No error
  23357.                 nsvErr    No such volume
  23358.  
  23359. æKY PBGetFCBInfo
  23360. æFp Files.p
  23361. æT FUNCTION
  23362. æD FUNCTION PBGetFCBInfo(paramBlock: FCBPBPtr;async: BOOLEAN): OSErr;
  23363. æDT myVariable := PBGetFCBInfo(paramBlock,async);
  23364. æRT 87
  23365. æRI IV-179, N87-1
  23366. æC  
  23367. Trap macro    _GetFCBInfo
  23368.  
  23369. Parameter block
  23370.   -->    12    ioCompletion  pointer
  23371.   <--    16    ioResult      word
  23372.   <--    18    ioNamePtr     pointer
  23373.   <->    22    ioVRefNum     word
  23374.   <->    24    ioRefNum      word
  23375.   -->    28    ioFCBIndx     long word
  23376.   <--    32    ioFCBFlNm     long word
  23377.   <--    36    ioFCBFlags    word
  23378.   <--    38    ioFCBStBlk    word
  23379.   <--    40    ioFCBEOF      long word
  23380.   <--    44    ioFCBPLen     long word
  23381.   <--    48    ioFCBCrPs     long word
  23382.   <--    52    ioFCBVRefNum  word
  23383.   <--    54    ioFCBClpSiz   long word
  23384.   <--    58    ioFCBParID    long word
  23385.  
  23386. PBGetFCBInfo returns information about the specified open file. If ioFCBIndx is
  23387. positive, the File Manager returns information about the file whose file number is
  23388. ioFCBIndx on the volume specified by ioVRefNum (which may contain a drive number,
  23389. volume reference number, or working directory reference number). If ioVRefNum is 0,
  23390. all open files are indexed; otherwise, only open files on the specified volume are
  23391. indexed.
  23392.  
  23393. If ioFCBIndx is 0, the File Manager returns information about the file whose access
  23394. path is specified by ioRefNum.
  23395.  
  23396. Assembly-language note:  The global variable FCBSPtr points to the
  23397.                          length word of the file-control-block buffer.
  23398.  
  23399. Each file control block contains 94 bytes of information about an access path; Figure
  23400. 28 shows its structure (using the assembly-language offsets).
  23401.  
  23402. •••Refer to Figure 28:•••
  23403.  
  23404. Figure 28–A File Control Block
  23405.  
  23406. 64K ROM note:  The structure of a file control block in the 64K ROM
  23407.                version of the File Manager is a subset of the above
  23408.                structure. The old file control block contained only
  23409.                the fields up to and including fcbFlPos.
  23410.  
  23411. FCBMdRByt (which corresponds to ioFCBFlags in the parameter block for PBGetFCBInfo)
  23412. contains flags that describe the status of the file, as follows:
  23413.  
  23414.   Bit    Meaning
  23415.   0     Set if data can be written to the file
  23416.   1     Set if the entry describes a resource fork
  23417.   7     Set if the file has been changed since it was last flushed
  23418.  
  23419. Warning:  The size and structure of a file control block may be
  23420.           different in future versions of Macintosh system software.
  23421.  
  23422. æKY PBGetCatInfo
  23423. æFp Files.p
  23424. æT FUNCTION
  23425. æD FUNCTION PBGetCatInfo(paramBlock: CInfoPBPtr;async: BOOLEAN): OSErr;
  23426. æDT myVariable := PBGetCatInfo(paramBlock,async);
  23427. æRT 68,69
  23428. æRI IV-155,  V-391, N68-1, N69, VI
  23429. æC 
  23430. Some existing HFS functions now support file IDs as appropriate, but their
  23431. interface remains stable. This section describes how they accommodate file IDs.
  23432.  
  23433. FUNCTION PBGetCatInfo (paramBlock: HParamBlkPtr, async: Boolean) : OSErr;
  23434.  
  23435. You can use PBGetCatInfo to determine whether a file has a file ID.  The value
  23436. of the file ID is returned in ioDirID. Because that parameter could also
  23437. represent a directory ID, call PBResolveFileID to see if the value is a real
  23438. file ID.  If you want to both determine whether a file ID exists for a file and
  23439. create one if it doesn’t, use PBCreateFileID, which will either create a file ID
  23440. or return fidExists.
  23441.  
  23442. •••Refer to Technical Note #69:•••
  23443.  
  23444. Trap macro    _GetCatInfo
  23445.  
  23446. Parameter block
  23447.   Files:                                   Directories:
  23448.   -->    12    ioCompletion   pointer      -->    12    ioCompletion  pointer
  23449.   <--    16    ioResult       word         <--    16    ioResult      word
  23450.   <->    18    ioNamePtr      pointer      <->    18    ioNamePtr     pointer
  23451.   -->    22    ioVRefNum      word         -->    22    ioVRefNum     word
  23452.   <--    24    ioFRefNum      word         <--    24    ioFRefNum     word
  23453.   -->    28    ioFDirIndex    word         -->    28    ioFDirIndex   word
  23454.   <--    30    ioFlAttrib     byte         <--    30    ioFlAttrib    byte
  23455.   <--    31    ioACUser       byte         access rights for directory only
  23456.   <--    32    ioFlFndrInfo   16 bytes     <--    32    ioDrUsrWds    16 bytes
  23457.   <->    48    ioDirID        long word    <->    48    ioDrDirID     long word
  23458.   <--    52    ioFlStBlk      word         <--    52    ioDrNmFls     word
  23459.   <--    54    ioFlLgLen      long word
  23460.   <--    58    ioFlPyLen      long word
  23461.   <--    62    ioFlRStBlk     word
  23462.   <--    64    ioFlRLgLen     long word
  23463.   <--    68    ioFlRPyLen     long word
  23464.   <--    72    ioFlCrDat      long word    <--    72    ioDrCrDat    long word
  23465.   <--    76    ioFlMdDat      long word    <--    76    ioDrMdDat    long word
  23466.   <--    80    ioFlBkDat      long word    <--    80    ioDrBkDat    long word
  23467.   <--    84    ioFlXFndrInfo  16 bytes     <--    84    ioDrFndrInfo 16 bytes
  23468.   <--    100   ioFlParID      long word    <--    100    ioDrParID   long word
  23469.   <--    104   ioFlClpSiz     long word
  23470.  
  23471. PBGetCatInfo gets information about the files and directories in a file catalog. To
  23472. determine whether the information is for a file or a directory, test bit 4 of ioFlAttrib,
  23473. as described in the section “CInfoPBRec”. The information that’s returned for files
  23474. is shown in the left column, and the corresponding information for directories is
  23475. shown in the right column.
  23476.  
  23477. If ioFDirIndex is positive, the File Manager returns information about the file or
  23478. directory whose directory index is ioFDirIndex in the directory specified by ioVRefNum
  23479. (this will be the root directory if a volume reference number is provided).
  23480.  
  23481. If ioFDirIndex is 0, the File Manager returns information about the file or directory
  23482. specified by ioNamePtr, in the directory specified by ioVRefNum
  23483. (again, this will be the root directory if a volume reference number is provided).
  23484.  
  23485. If ioFDirIndex is negative, the File Manager ignores ioNamePtr and returns information
  23486. about the directory specified by ioDirID.
  23487.  
  23488. With files, PBGetCatInfo is similar to PBHGetFileInfo but returns some additional
  23489. information. If the file is open, the reference number of the first access path found
  23490. is returned in ioFRefNum, and the name of the file is returned in ioNamePtr (unless
  23491. ioNamePtr is NIL).
  23492.  
  23493. For server volume directories, in addition to the normal return parameters the ioACUser
  23494. field returns the user’s access rights in the following format:
  23495.  
  23496.   Bit    7    if set, user is not the owner of the directory.
  23497.               if clear, user is the owner of the directory.
  23498.          6–3  Reserved; this is returned set to zero.
  23499.          2    If set, user does not have Make Changes privileges
  23500.               to the directory.
  23501.               If clear, user has Make Changes privileges to the directory.
  23502.          1    If set, user does not have See Files privileges to the directory.
  23503.               If clear, user has See Files privileges to the directory.
  23504.          0    If set, user does not have See Folders privileges
  23505.               to the directory.
  23506.               If clear, user has See Folders privileges to the directory.
  23507.  
  23508. For example, if ioACUser returns zero for a given server volume directory, you know
  23509. that the user is the owner of the directory and has complete privileges to it.
  23510.  
  23511. Result codes    noErr     No error
  23512.                 bdNamErr  Bad file name
  23513.                 dirNFErr  Directory not found or incomplete pathname
  23514.                 extFSErr  External file system
  23515.                 fnfErr    File not found
  23516.                 ioErr     I/O error
  23517.                 nsvErr    No such volume
  23518.                 paramErr  No default volume
  23519.  
  23520. æKY PBSetCatInfo
  23521. æFp Files.p
  23522. æT FUNCTION
  23523. æD FUNCTION PBSetCatInfo(paramBlock: CInfoPBPtr;async: BOOLEAN): OSErr;
  23524. æDT myVariable := PBSetCatInfo(paramBlock,async);
  23525. æRI IV-156
  23526. æC 
  23527. Trap macro    _SetCatInfo
  23528.  
  23529. Parameter block
  23530.  
  23531.   Files:                                  Directories:
  23532.   -->    12    ioCompletion  pointer      -->    12    ioCompletion  pointer
  23533.   <--    16    ioResult      word         <--    16    ioResult      word
  23534.   <->    18    ioNamePtr     pointer      <->    18    ioNamePtr     pointer
  23535.   -->    22    ioVRefNum     word         -->    22    ioVRefNum     word
  23536.   -->    30    ioFlAttrib    byte         -->    30    ioFlAttrib    byte
  23537.   -->    32    ioFlFndrInfo  16 bytes     -->    32    ioDrUsrWds    16 bytes
  23538.   -->    48    ioDirID       long word    -->    48    ioDrDirID     long word
  23539.   -->    72    ioFlCrDat     long word    -->    72    ioDrCrDat     long word
  23540.   -->    76    ioFlMdDat     long word    -->    76    ioDrMdDat     long word
  23541.   -->    80    ioFlBkDat     long word    -->    80    ioDrBkDat     long word
  23542.   -->    84    ioFlXFndrInfo 16 bytes     -->    84    ioDrFndrInfo  16 bytes
  23543.   -->    104   ioFlClpSiz    long word
  23544.  
  23545. PBSetCatInfo sets information about the files and directories in a catalog. With
  23546. files, it’s similar to PBHSetFileInfo but lets you set some additional information.
  23547. The information that can be set for files is shown in the left column, and the corresponding
  23548. information for directories is shown in the right column.
  23549.  
  23550. Result codes    noErr     No error
  23551.                 bdNamErr  Bad file name
  23552.                 dirNFErr  Directory not found or incomplete pathname
  23553.                 extFSErr  External file system
  23554.                 fnfErr    File not found
  23555.                 ioErr     I/O error
  23556.                 nsvErr    No such volume
  23557.                 paramErr  No default volume
  23558.  
  23559. æKY PBAllocContig
  23560. æFp Files.p
  23561. æT FUNCTION
  23562. æD FUNCTION PBAllocContig(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  23563. æDT myVariable := PBAllocContig(paramBlock,async);
  23564. æRI IV-143
  23565. æC 
  23566. Trap macro    _AllocContig
  23567.  
  23568. Parameter block
  23569.   -->    12    ioCompletion  pointer
  23570.   <--    16    ioResult      word
  23571.   -->    24    ioRefNum      word
  23572.   -->    36    ioReqCount    long word
  23573.   <--    40    ioActCount    long word
  23574.  
  23575. PBAllocContig is identical to PBAllocate except that if there isn’t enough contiguous
  23576. empty space on the volume to satisfy the allocation request, PBAllocContig will do
  23577. nothing and will return dskFulErr as its function result. If you want to allocate
  23578. whatever space is available, even when the entire request cannot be filled as a
  23579. contiguous piece, call PBAllocate instead.
  23580.  
  23581. Result codes    noErr      No error
  23582.                 dskFulErr  Disk full
  23583.                 fLckdErr   File locked
  23584.                 fnOpnErr   File not open
  23585.                 ioErr      I/O error
  23586.                 rfNumErr   Bad reference number
  23587.                 vLckdErr   Software volume lock
  23588.                 wPrErr     Hardware volume lock
  23589.                 wrPermErr  Read/write permission doesn’t allow writing
  23590.  
  23591. æKY PBLockRange
  23592. æFp Files.p
  23593. æT FUNCTION
  23594. æD FUNCTION PBLockRange(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  23595. æDT myVariable := PBLockRange(paramBlock,async);
  23596. æRT 186
  23597. æRI IV-138
  23598. æC 
  23599. •••Refer to Technical Note #186:•••
  23600.  
  23601. Trap macro    _LockRng
  23602.  
  23603. Parameter block
  23604.   -->    12    ioCompletion  pointer
  23605.   <--    16    ioResult      word
  23606.   -->    24    ioRefNum      word
  23607.   -->    36    ioReqCount    long word
  23608.   -->    44    ioPosMode     word
  23609.   -->    46    ioPosOffset   long word
  23610.  
  23611. On a file opened with a shared read/write permission, PBLockRange is used in conjunction
  23612. with PBRead and PBWrite to lock a certain portion of the file. PBLockRange uses the
  23613. same parameters as both PBRead and PBWrite; by calling it immediately before PBRead,
  23614. you can use the information present in the parameter block for the PBRead call.
  23615.  
  23616. When you’re finished with the data (typically after a call to PBWrite), be sure to
  23617. call PBUnlockRange to free up that portion of the file for subsequent PBRead calls.
  23618.  
  23619. Warning:  PBLockRange operates only with the hierarchical version of the
  23620.           File Manager; if used on a Macintosh equipped only with the 64K
  23621.           ROM version of the File Manager, it will generate a system error.
  23622.  
  23623. Result codes    noErr     No error
  23624.                 eofErr    End-of-file
  23625.                 extFSErr  External file system
  23626.                 fnOpnErr  File not open
  23627.                 ioErr     I/O error
  23628.                 paramErr  Negative ioReqCount
  23629.                 rfNumErr  Bad reference number
  23630.  
  23631. æKY PBUnlockRange
  23632. æFp Files.p
  23633. æT FUNCTION
  23634. æD FUNCTION PBUnlockRange(paramBlock: ParmBlkPtr;async: BOOLEAN): OSErr;
  23635. æDT myVariable := PBUnlockRange(paramBlock,async);
  23636. æRT 186
  23637. æRI IV-139
  23638. æC 
  23639. Trap macro    _UnlockRng
  23640.  
  23641. Parameter block
  23642.   -->    12    ioCompletion  pointer
  23643.   <--    16    ioResult      word
  23644.   -->    24    ioRefNum      word
  23645.   -->    36    ioReqCount    long word
  23646.   -->    44    ioPosMode     word
  23647.   -->    46    ioPosOffset   long word
  23648.  
  23649. PBUnlockRange is used in conjunction with PBRead and PBWrite to unlock a certain
  23650. portion of a file that you locked with PBLockRange.
  23651.  
  23652. Warning:  PBUnlockRange operates only with the hierarchical version of
  23653.           the File Manager; if used on a Macintosh equipped only with
  23654.           the 64K ROM version of the File Manager, it will generate a
  23655.           system error.
  23656.  
  23657. Result codes    noErr     No error
  23658.                 eofErr    End-of-file
  23659.                 extFSErr  External file system
  23660.                 fnOpnErr  File not open
  23661.                 ioErr     I/O error
  23662.                 paramErr  Negative ioReqCount
  23663.                 rfNumErr  Bad reference number
  23664.  
  23665. æKY PBSetVInfo
  23666. æFp Files.p
  23667. æT FUNCTION
  23668. æD FUNCTION PBSetVInfo(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23669. æDT myVariable := PBSetVInfo(paramBlock,async);
  23670. æRT 204
  23671. æRI IV-131
  23672. æC 
  23673. •••Refer to Technical Note #204:•••
  23674.  
  23675. Trap macro    _SetVolInfo
  23676.  
  23677. Parameter block
  23678.   -->    12    ioCompletion  pointer
  23679.   <--    16    ioResult      word
  23680.   -->    18    ioNamePtr     pointer
  23681.   -->    22    ioVRefNum     word
  23682.   -->    30    ioVCrDate     long word
  23683.   -->    34    ioVLsMod      long word
  23684.   -->    38    ioVAtrb       word
  23685.   -->    52    ioVClpSiz     long word
  23686.   -->    72    ioVBkUp       long word
  23687.   -->    76    ioVSeqNum     word
  23688.   -->    90    ioVFndrInfo   32 bytes
  23689.  
  23690. PBSetVInfo lets you modify information about volumes. A pointer to a new name for the
  23691. volume can be specified in ioNamePtr. The date and time of the volume’s creation and
  23692. modification can be set with ioVCrDate and ioVLsMod respectively. Only bit 15 of
  23693. ioVAtrb can be changed; setting it locks the volume.
  23694.  
  23695. Note:  The volume cannot be specified by name; you must use either the
  23696.        volume reference number or the drive number.
  23697.  
  23698. Warning:  PBSetVInfo operates only with the hierarchical version of the
  23699.           File Manager; if used on a Macintosh equipped only with the
  23700.           64K ROM version of the File Manager, it will generate a system error.
  23701.  
  23702. Result codes    noErr       No error
  23703.                 nsvErr      No such volume
  23704.                 paramErr    No default volume
  23705.  
  23706. æKY PBHGetVInfo
  23707. æFp Files.p
  23708. æT FUNCTION
  23709. æD FUNCTION PBHGetVInfo(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23710. æDT myVariable := PBHGetVInfo(paramBlock,async);
  23711. æRT 24, 66, 67, 77, 106, 157
  23712. æRI IV-130, N66-1, N67-1, N77-5  
  23713. æC 
  23714. Trap macro    _HGetVInfo
  23715.  
  23716. Parameter block
  23717.   -->    12    ioCompletion  pointer
  23718.   <--    16    ioResult      word
  23719.   <->    18    ioNamePtr     pointer
  23720.   <->    22    ioVRefNum     word
  23721.   -->    28    ioVolIndex    word
  23722.   <--    30    ioVCrDate     long word
  23723.   <--    34    ioVLsMod      long word
  23724.   <--    38    ioVAtrb       word
  23725.   <--    40    ioVNmFls      word
  23726.   <--    42    ioVBitMap     word
  23727.   <--    44    ioVAllocPtr   word
  23728.   <--    46    ioVNmAlBlks   word
  23729.   <--    48    ioVAlBlkSiz   long word
  23730.   <--    52    ioVClpSiz     long word
  23731.   <--    56    ioAlBlSt      word
  23732.   <--    58    ioVNxtFNum    long word
  23733.   <--    62    ioVFrBlk      word
  23734.   <--    64    ioVSigWord    word
  23735.   <--    66    ioVDrvInfo    word
  23736.   <--    68    ioVDRefNum    word
  23737.   <--    70    ioVFSID       word
  23738.   <--    72    ioVBkUp       long word
  23739.   <--    76    ioVSeqNum     word
  23740.   <--    78    ioVWrCnt      long word
  23741.   <--    82    ioVFilCnt     long word
  23742.   <--    86    ioVDirCnt     long word
  23743.   <--    90    ioVFndrInfo   32 bytes
  23744.  
  23745. PBHGetVInfo is similar in function to PBGetVInfo but returns a larger parameter
  23746. block. In addition, PBHGetVInfo always returns the volume reference number in ioVRefNum
  23747. (regardless of what was passed in). Also, ioVNmAlBlks and ioVFrBlks are not clipped
  23748. as they are by PBGetVInfo.
  23749.  
  23750. Result codes    noErr       No error
  23751.                 nsvErr      No such volume
  23752.                 paramErr    No default volume
  23753.  
  23754. æKY PBHOpen
  23755. æFp Files.p
  23756. æT FUNCTION
  23757. æD FUNCTION PBHOpen(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23758. { Trap macro  _HOpen
  23759.  
  23760. Parameter block
  23761.     —>  12  ioCompletion    pointer
  23762.     <—  16  ioResult        word
  23763.     —>  18  ioNamePtr       pointer
  23764.     —>  22  ioVRefNum       word
  23765.     <—  24  ioRefNum        word
  23766.     —>  27  ioPermssn       byte
  23767.     —>  28  ioMisc          pointer
  23768.     —>  48  ioDirID         long word
  23769.  
  23770.     PBHOpen is identical to PBOpen except that it accepts a directory ID
  23771. in ioDirID.
  23772.  
  23773. Result codes    noErr       No error
  23774.                 bdNamErr    Bad file name
  23775.                 dirNFErr    Directory not found or incomplete pathname
  23776.                 extFSErr    External file system
  23777.                 fnfErr      File not found
  23778.                 ioErr       I/O error
  23779.                 nsvErr      No such volume
  23780.                 opWrErr     File already open for writing
  23781.                 permErr     Attempt to open locked file for writing
  23782.                 tmfoErr     Too many files open
  23783.  }
  23784. æDT myVariable := PBHOpen(paramBlock,async);
  23785. æRT 204
  23786. æRI IV-136 
  23787. æC 
  23788. Trap macro    _HOpen
  23789.  
  23790. Parameter block
  23791.   -->    12    ioCompletion  pointer
  23792.   <--    16    ioResult      word
  23793.   -->    18    ioNamePtr     pointer
  23794.   -->    22    ioVRefNum     word
  23795.   <--    24    ioRefNum      word
  23796.   -->    27    ioPermssn     byte
  23797.   -->    28    ioMisc        pointer
  23798.   -->    48    ioDirID       long word
  23799.  
  23800. PBHOpen is identical to PBOpen except that it accepts a directory ID in ioDirID.
  23801.  
  23802. Result codes    noErr     No error
  23803.                 bdNamErr  Bad file name
  23804.                 dirNFErr  Directory not found or incomplete pathname
  23805.                 extFSErr  External file system
  23806.                 fnfErr    File not found
  23807.                 ioErr     I/O error
  23808.                 nsvErr    No such volume
  23809.                 opWrErr   File already open for writing
  23810.                 permErr   Attempt to open locked file for writing
  23811.                 tmfoErr   Too many files open
  23812.  
  23813. æKY PBHOpenRF
  23814. æFp Files.p
  23815. æT FUNCTION
  23816. æD FUNCTION PBHOpenRF(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23817. { Trap macro  _HOpenRF
  23818.  
  23819. Parameter block
  23820.     —>  12  ioCompletion    pointer
  23821.     <—  16  ioResult        word
  23822.     —>  18  ioNamePtr       pointer
  23823.     —>  22  ioVRefNum       word
  23824.     <—  24  ioRefNum        word
  23825.     —>  27  ioPermssn       byte
  23826.     —>  28  ioMisc          pointer
  23827.     —>  48  ioDirID         long word
  23828.  
  23829.     PBHOpenRF is identical to PBOpenRF except that it accepts a
  23830. directory ID in ioDirID.
  23831.  
  23832. Result codes    noErr       No error
  23833.                 bdNamErr    Bad file name
  23834.                 dirNFErr    Directory not found or incomplete pathname
  23835.                 extFSErr    External file system
  23836.                 fnfErr      File not found
  23837.                 ioErr       I/O error
  23838.                 nsvErr      No such volume
  23839.                 opWrErr     File already open for writing
  23840.                 permErr     Attempt to open locked file for writing
  23841.                 tmfoErr     Too many files open
  23842.  }
  23843. æDT myVariable := PBHOpenRF(paramBlock,async);
  23844. æRI IV-137
  23845. æC 
  23846. Trap macro    _HOpenRF
  23847.  
  23848. Parameter block
  23849.   -->    12    ioCompletion  pointer
  23850.   <--    16    ioResult      word
  23851.   -->    18    ioNamePtr     pointer
  23852.   -->    22    ioVRefNum     word
  23853.   <--    24    ioRefNum      word
  23854.   -->    27    ioPermssn     byte
  23855.   -->    28    ioMisc        pointer
  23856.   -->    48    ioDirID       long word
  23857.  
  23858. PBHOpenRF is identical to PBOpenRF except that it accepts a directory ID in ioDirID.
  23859.  
  23860. Result codes    noErr     No error
  23861.                 bdNamErr  Bad file name
  23862.                 dirNFErr  Directory not found or incomplete pathname
  23863.                 extFSErr  External file system
  23864.                 fnfErr    File not found
  23865.                 ioErr     I/O error
  23866.                 nsvErr    No such volume
  23867.                 opWrErr   File already open for writing
  23868.                 permErr   Attempt to open locked file for writing
  23869.                 tmfoErr   Too many files open
  23870.  
  23871. æKY PBHOpenDF
  23872. æFp Files.p
  23873. æT FUNCTION
  23874. æD FUNCTION PBHOpenDF(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23875. æDT myVariable := PBHOpenDF(paramBlock,async);
  23876. æRI IV-137, VI
  23877. æC 
  23878. PBHOpenDF creates an access path to the data fork of a file. It is an HFS
  23879. version of PBOpenDF.
  23880.  
  23881. Trap macro  _HOpenRF
  23882.  
  23883. Parameter block
  23884.   —>  12  ioCompletion  pointer
  23885.   <—  16  ioResult  word
  23886.   —>  18  ioNamePtr  pointer
  23887.   —>  22  ioVRefNum  word
  23888.   <—  24  ioRefNum  word
  23889.   —>  27  ioPermssn  byte
  23890.   —>  28  ioMisc  pointer
  23891.   —>  48  ioDirID  long word
  23892.  
  23893.  
  23894. Result codes  noErr  No error
  23895.   bdNamErr  Bad file name
  23896.   dirNFErr  Directory not found or incomplete pathname
  23897.   extFSErr  External file system
  23898.   fnfErr  File not found
  23899.   ioErr   I/O error
  23900.   nsvErr  No such volume
  23901.   opWrErr  File already open for writing
  23902.   permErr  Attempt to open locked file for writing
  23903.   tmfoErr  Too many files open
  23904.  
  23905.  
  23906. æKY PBHCreate
  23907. æFp Files.p
  23908. æT FUNCTION
  23909. æD FUNCTION PBHCreate(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23910. æDT myVariable := PBHCreate(paramBlock,async);
  23911. æRI IV-146 
  23912. æC 
  23913. Trap macro    _HCreate
  23914.  
  23915. Parameter block
  23916.   -->    12    ioCompletion  pointer
  23917.   <--    16    ioResult      word
  23918.   -->    18    ioNamePtr     pointer
  23919.   -->    22    ioVRefNum     word
  23920.   -->    48    ioDirID       long word
  23921.  
  23922. PBHCreate is identical to PBCreate except that it accepts a directory ID in ioDirID.
  23923.  
  23924. Note:  To create a directory instead of a file, call PBDirCreate.
  23925.  
  23926. Result codes    noErr      No error
  23927.                 bdNamErr   Bad file name
  23928.                 dupFNErr   Duplicate file name and version
  23929.                 dirFulErr  File directory full
  23930.                 dirNFErr   Directory not found or incomplete pathname
  23931.                 extFSErr   External file system
  23932.                 ioErr      I/O error
  23933.                 nsvErr     No such volume
  23934.                 vLckdErr   Software volume lock
  23935.                 wPrErr     Hardware volume lock
  23936.  
  23937. æKY PBHDelete
  23938. æFp Files.p
  23939. æT FUNCTION
  23940. æD FUNCTION PBHDelete(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23941. æDT myVariable := PBHDelete(paramBlock,async);
  23942. æRI IV-147, VI
  23943. æC 
  23944. Some existing HFS functions now support file IDs as appropriate, but their
  23945. interface remains stable. This section describes how they accommodate file IDs.
  23946.  
  23947. FUNCTION PBHDelete (paramBlock: HParamBlkPtr, async: Boolean) : OSErr;
  23948.  
  23949. If a file ID exists for the file being deleted, the file ID is also deleted.
  23950.  
  23951. Trap macro    _HDelete
  23952.  
  23953. Parameter block
  23954.   -->    12    ioCompletion  pointer
  23955.   <--    16    ioResult      word
  23956.   -->    18    ioNamePtr     pointer
  23957.   -->    22    ioVRefNum     word
  23958.   -->    48    ioDirID       long word
  23959.  
  23960. PBHDelete is identical to PBDelete except that it accepts a directory ID in ioDirID.
  23961. PBHDelete can be used to delete an empty directory as well.
  23962.  
  23963. Result codes    noErr     No error
  23964.                 bdNamErr  Bad file name
  23965.                 dirNFErr  Directory not found or incomplete pathname
  23966.                 extFSErr  External file system
  23967.                 fBsyErr   File busy, directory not empty, or working
  23968.                           directory control block open
  23969.                 fLckdErr  File locked
  23970.                 fnfErr    File not found
  23971.                 nsvErr    No such volume
  23972.                 ioErr     I/O error
  23973.                 vLckdErr  Software volume lock
  23974.                 wPrErr    Hardware volume lock
  23975.  
  23976. æKY PBHRename
  23977. æFp Files.p
  23978. æT FUNCTION
  23979. æD FUNCTION PBHRename(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  23980. æDT myVariable := PBHRename(paramBlock,async);
  23981. æRI IV-154, VI 
  23982. æC 
  23983. Some existing HFS functions now support file IDs as appropriate, but their
  23984. interface remains stable. This section describes how they accommodate file IDs.
  23985.  
  23986. FUNCTION PBHRename (paramBlock: HParamBlkPtr, async: Boolean) : OSErr;
  23987.  
  23988. If a file ID exists for the file being renamed, the file ID remains with the
  23989. file.
  23990. _____________________________________________________________________________
  23991. Trap macro    _HRename
  23992.  
  23993. Parameter block
  23994.   -->    12    ioCompletion  pointer
  23995.   <--    16    ioResult      word
  23996.   -->    18    ioNamePtr     pointer
  23997.   -->    22    ioVRefNum     word
  23998.   -->    28    ioMisc        pointer
  23999.   -->    48    ioDirID       long word
  24000.  
  24001. PBHRename is identical to PBRename except that it accepts a directory ID in ioDirID
  24002. and can be used to rename directories as well as files and volumes. Given a pointer
  24003. to the name of a file or directory in ioNamePtr, PBHRename changes it to the name
  24004. pointed to by ioMisc. Given a pointer to a volume name in ioNamePtr or a volume
  24005. reference number in ioVRefNum, it changes the name of the volume to the name pointed
  24006. to by ioMisc.
  24007.  
  24008. Warning:  PBHRename cannot be used to change the directory a file is in.
  24009.  
  24010. Result codes    noErr      No error
  24011.                 bdNamErr   Bad file name
  24012.                 dirFulErr  File directory full
  24013.                 dirNFErr   Directory not found or incomplete pathname
  24014.                 dupFNErr   Duplicate file name and version
  24015.                 extFSErr   External file system
  24016.                 fLckdErr   File locked
  24017.                 fnfErr     File not found
  24018.                 fsRnErr    Problem during rename
  24019.                 ioErr      I/O error
  24020.                 nsvErr     No such volume
  24021.                 paramErr   No default volume
  24022.                 vLckdErr   Software volume lock
  24023.                 wPrErr     Hardware volume lock
  24024.  
  24025. æKY PBHRstFLock
  24026. æFp Files.p
  24027. æT FUNCTION
  24028. æD FUNCTION PBHRstFLock(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24029. æDT myVariable := PBHRstFLock(paramBlock,async);
  24030. æRI IV-152 
  24031. æC 
  24032. Trap macro    _HRstFLock
  24033.  
  24034. Parameter block
  24035.   -->    12    ioCompletion  pointer
  24036.   <--    16    ioResult      word
  24037.   -->    18    ioNamePtr     pointer
  24038.   -->    22    ioVRefNum     word
  24039.   -->    48    ioDirID       long word
  24040.  
  24041. PBHRstFLock is identical to PBRstFLock except that it accepts a directory ID in
  24042. ioDirID.
  24043.  
  24044. Result codes    noErr     No error
  24045.                 dirNFErr  Directory not found or incomplete pathname
  24046.                 extFSErr  External file system
  24047.                 fnfErr    File not found
  24048.                 ioErr     I/O error
  24049.                 nsvErr    No such volume
  24050.                 vLckdErr  Software volume lock
  24051.                 wPrErr    Hardware volume lock
  24052.     
  24053.  
  24054. æKY PBHSetFLock
  24055. æFp Files.p
  24056. æT FUNCTION
  24057. æD FUNCTION PBHSetFLock(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24058. æDT myVariable := PBHSetFLock(paramBlock,async);
  24059. æRI IV-151
  24060. æC 
  24061. Trap macro    _HSetFLock
  24062.  
  24063. Parameter block
  24064.   -->    12    ioCompletion  pointer
  24065.   <--    16    ioResult      word
  24066.   -->    18    ioNamePtr     pointer
  24067.   -->    22    ioVRefNum     word
  24068.   -->    48    ioDirID       long word
  24069.  
  24070. PBHSetFLock is identical to PBSetFLock except that it accepts a directory ID in
  24071. ioDirID.
  24072.  
  24073. Result codes    noErr     No error
  24074.                 dirNFErr  Directory not found or incomplete pathname
  24075.                 extFSErr  External file system
  24076.                 fnfErr    File not found
  24077.                 ioErr     I/O error
  24078.                 nsvErr    No such volume
  24079.                 vLckdErr  Software volume lock
  24080.                 wPrErr    Hardware volume lock
  24081.  
  24082. æKY PBHGetFInfo
  24083. æFp Files.p
  24084. æT FUNCTION
  24085. æD FUNCTION PBHGetFInfo(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24086. æDT myVariable := PBHGetFInfo(paramBlock,async);
  24087. æRI IV-149 
  24088. æC 
  24089. Trap macro    _HGetFileInfo
  24090.  
  24091. Parameter block
  24092.   -->    12    ioCompletion  pointer
  24093.   <--    16    ioResult      word
  24094.   <->    18    ioNamePtr     pointer
  24095.   -->    22    ioVRefNum     word
  24096.   <--    24    ioFRefNum     word
  24097.   -->    28    ioFDirIndex   word
  24098.   <--    30    ioFlAttrib    byte
  24099.   <--    32    ioFlFndrInfo  16 bytes
  24100.   <->    48    ioDirID       long word
  24101.   <--    52    ioFlStBlk     word
  24102.   <--    54    ioFlLgLen     long word
  24103.   <--    58    ioFlPyLen     long word
  24104.   <--    62    ioFlRStBlk    word
  24105.   <--    64    ioFlRLgLen    long word
  24106.   <--    68    ioFlRPyLen    long word
  24107.   <--    72    ioFlCrDat     long word
  24108.   <--    76    ioFlMdDat     long word
  24109.  
  24110. PBHGetFInfo is identical to PBGetFInfo except that it accepts a directory ID in
  24111. ioDirID.
  24112.  
  24113. Result codes    noErr     No error
  24114.                 bdNamErr  Bad file name
  24115.                 dirNFErr  Directory not found or incomplete pathname
  24116.                 extFSErr  External file system
  24117.                 fnfErr    File not found
  24118.                 ioErr     I/O error
  24119.                 nsvErr    No such volume
  24120.                 paramErr  No default volume
  24121.  
  24122. æKY PBHSetFInfo
  24123. æFp Files.p
  24124. æT FUNCTION
  24125. æD FUNCTION PBHSetFInfo(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24126. æDT myVariable := PBHSetFInfo(paramBlock,async);
  24127. æRI IV-150
  24128. æC 
  24129. Trap macro    _HSetFileInfo
  24130.  
  24131. Parameter block
  24132.   -->    12    ioCompletion  pointer
  24133.   <--    16    ioResult      word
  24134.   -->    18    ioNamePtr     pointer
  24135.   -->    22    ioVRefNum     word
  24136.   -->    32    ioFlFndrInfo  16 bytes
  24137.   -->    48    ioDirID       long word
  24138.   -->    72    ioFlCrDat     long word
  24139.   -->    76    ioFlMdDat     long word
  24140.  
  24141. PBHSetFInfo is identical to PBSetFInfo except that it accepts a directory ID in
  24142. ioDirID.
  24143.  
  24144. Result codes    noErr     No error
  24145.                 bdNamErr  Bad file name
  24146.                 dirNFErr  Directory not found or incomplete pathname
  24147.                 extFSErr  External file system
  24148.                 fLckdErr  File locked
  24149.                 fnfErr    File not found
  24150.                 ioErr     I/O error
  24151.                 nsvErr    No such volume
  24152.                 vLckdErr  Software volume lock
  24153.                 wPrErr    Hardware volume lock
  24154.  
  24155. æKY PBGetAltAccess
  24156. æFp Files.p
  24157. æT FUNCTION
  24158. æD FUNCTION PBGetAltAccess(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24159. æDT myVariable := PBGetAltAccess(paramBlock,async);
  24160. æRI VI
  24161. æC 
  24162. Parameter block
  24163.   Æ   12  ioCompletion   long  pointer to completion routine
  24164.   ¨   16  ioResult       word  result code
  24165.   Æ   18  ioNamePtr      long  pointer to volume name
  24166.   ¨   22  ioVRefNum      word  volume reference number
  24167.   ¨   32  ioBuffer       long  pointer to privilege info buffer
  24168.   Æ   36  ioReqCount     long  size allocated for buffer
  24169.   ¨   40  ioActCount     long  amount used in buffer
  24170.   ¨   44  ioAccessInfo1  long  information specific to privilege model
  24171.   ¨   48  ioAccessInfo2  long  information specific to privilege model
  24172.   ¨   52  ioAccessInfo3  long  information specific to privilege model
  24173.   ¨   56  ioAccessInfo4  long  information specific to privilege model
  24174.   Æ   60  ioDirID        word  parent directory ID
  24175.  
  24176. PBGetAltAccess retrieves access information from a volume managed by a file
  24177. system that uses a privilege model different from the AFP model.
  24178.  
  24179. Result codes
  24180. <to come>
  24181.  
  24182. æKY PBSetAltAccess
  24183. æFp Files.p
  24184. æT FUNCTION
  24185. æD FUNCTION PBSetAltAccess(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24186. æDT myVariable := PBSetAltAccess(paramBlock,async);
  24187. æRI VI
  24188. æC
  24189. Parameter block
  24190.   Æ   12  ioCompletion   long  pointer to completion routine
  24191.   ¨   16  ioResult       word  result code
  24192.   Æ   18  ioNamePtr      long  pointer to volume name
  24193.   Æ   22  ioVRefNum      word  volume reference number
  24194.   ¨   32  ioBuffer       long  pointer to privilege info buffer
  24195.   Æ   36  ioReqCount     long  size allocated for buffer
  24196.   ¨   40  ioActCount     long  amount used in buffer
  24197.   Æ   44  ioAccessInfo1  long  information specific to privilege model
  24198.   Æ   48  ioAccessInfo2  long  information specific to privilege model
  24199.   Æ   52  ioAccessInfo3  long  information specific to privilege model
  24200.   Æ   56  ioAccessInfo4  long  information specific to privilege model
  24201.   Æ   60  ioDirID        word  parent directory ID
  24202.  
  24203. PBSetAltAccess modifies access information from a volume managed by a file
  24204. system that uses a privilege model different from the AFP model.
  24205.  
  24206. Result codes
  24207. <to come>
  24208.  
  24209.  
  24210.  
  24211. æKY PBMakeFSSpec
  24212. æFp Files.p
  24213. æT FUNCTION
  24214. æD FUNCTION PBMakeFSSpec(paramBlock: HParamBlkPtr;async: BOOLEAN): OSErr;
  24215. æDT myVariable := PBMakeFSSpec(paramBlock,async);
  24216. æC 
  24217.  
  24218. æKY FInitQueue
  24219. æFp Files.p
  24220. æT PROCEDURE
  24221. æTN A016
  24222. æD PROCEDURE FInitQueue;
  24223.     INLINE $A016;
  24224. æDT FInitQueue;
  24225. æRI II-103, IV-128
  24226. æC 
  24227. Trap macro    _InitQueue
  24228.  
  24229. FInitQueue clears all queued File Manager calls except the current one.
  24230.  
  24231. æKY GetFSQHdr
  24232. æFp Files.p
  24233. æT FUNCTION
  24234. æD FUNCTION GetFSQHdr: QHdrPtr;
  24235. æDT myVariable := GetFSQHdr;
  24236. æRI II-125, IV-175
  24237. æC 
  24238. You can get a pointer to the header of the file I/O queue by calling the File Manager
  24239. function GetFSQHdr.
  24240.  
  24241. FUNCTION GetFSQHdr :  QHdrPtr; [Not in ROM]
  24242.  
  24243. GetFSQHdr returns a pointer to the header of the file I/O queue.
  24244.  
  24245. Assembly-language note:  The global variable FSQHdr contains the
  24246.                          header of the file I/O queue.
  24247.  
  24248. æKY GetDrvQHdr
  24249. æFp Files.p
  24250. æT FUNCTION
  24251. æD FUNCTION GetDrvQHdr: QHdrPtr;
  24252. æDT myVariable := GetDrvQHdr;
  24253. æRI II-128, IV-181
  24254. æC 
  24255. You can get a pointer to the header of the drive queue by calling the File Manager
  24256. function GetDrvQHdr.
  24257.  
  24258. FUNCTION GetDrvQHdr :  QHdrPtr; [Not in ROM]
  24259.  
  24260. GetDrvQHdr returns a pointer to the header of the drive queue.
  24261.  
  24262. Assembly-language note:  The global variable DrvQHdr contains the
  24263.                          header of the drive queue.
  24264.  
  24265. The drive queue can support any number of drives, limited only by memory space.
  24266.  
  24267. æKY GetVCBQHdr
  24268. æFp Files.p
  24269. æT FUNCTION
  24270. æD FUNCTION GetVCBQHdr: QHdrPtr;
  24271. æDT myVariable := GetVCBQHdr;
  24272. æRI II-126, IV-178
  24273. æC 
  24274. You can get a pointer to the header of the volume-control-block queue by calling the
  24275. File Manager function GetVCBQHdr.
  24276.  
  24277. FUNCTION GetVCBQHdr :  QHdrPtr; [Not in ROM]
  24278.  
  24279. GetVCBQHdr returns a pointer to the header of the volume-control-block queue.
  24280.  
  24281. Assembly-language note:  The global variable VCBQHdr contains the header
  24282.                          of the volume-control-block-queue. The default
  24283.                          volume’s volume control block is pointed to by
  24284.                          the global variable DefVCBPtr.
  24285.  
  24286. æKY HGetVol
  24287. æFp Files.p
  24288. æT FUNCTION
  24289. æD FUNCTION HGetVol(volName: StringPtr;VAR vRefNum: INTEGER;VAR dirID: LONGINT): OSErr;
  24290. æDT myVariable := HGetVol(volName,vRefNum,dirID);
  24291. æRI IV-132, VI
  24292. æC 
  24293. HGetVol  is an HFS version of the MFS function GetVol. It calls the function
  24294. PBHGetVol, documented in the File Manager chapter of Volume IV. vRefNum can hold
  24295. a volume reference number or a working directory reference number. dirID holds a
  24296. directory ID.
  24297.  
  24298. æKY HSetVol
  24299. æFp Files.p
  24300. æT FUNCTION
  24301. æD FUNCTION HSetVol(volName: StringPtr;vRefNum: INTEGER;dirID: LONGINT): OSErr;
  24302. æDT myVariable := HSetVol(volName,vRefNum,dirID);
  24303. æRI IV-133, VI
  24304. æC 
  24305. HSetVol is an HFS version of the MFS function GetVol. It calls the function
  24306. PBHGetVol, documented in the File Manager chapter of Volume IV. vRefNum can hold
  24307. a volume reference number or a working directory reference number. dirID holds a
  24308. directory ID.
  24309. <Note: Don’t use HSetVol or PBHSetVol.>
  24310.  
  24311. æKY HOpen
  24312. æFp Files.p
  24313. æT FUNCTION
  24314. æD FUNCTION HOpen(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;permission: SignedByte;
  24315.     VAR refNum: INTEGER): OSErr;
  24316. æDT myVariable := HOpen(vRefNum,dirID,fileName,permission,refNum);
  24317. æRI IV-136, VI
  24318. æC 
  24319. HOpen creates an access path to the data fork of a file. It is an HFS version of
  24320. the MFS function Open. It calls the function PBHOpen, documented in the File
  24321. Manager chapter of Volume IV.
  24322.  
  24323. æKY HOpenRF
  24324. æFp Files.p
  24325. æT FUNCTION
  24326. æD FUNCTION HOpenRF(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;permission: SignedByte;
  24327.     VAR refNum: INTEGER): OSErr;
  24328. æDT myVariable := HOpenRF(vRefNum,dirID,fileName,permission,refNum);
  24329. æRI IV-137, VI
  24330. æC 
  24331. HOpenRF creates an access path to the resource fork of a file. It is an HFS
  24332. version of the MFS function OpenRF. It calls the function PBHOpenRF, documented
  24333. in the File Manager chapter of Volume IV.
  24334.  
  24335. æKY AllocContig
  24336. æFp Files.p
  24337. æT FUNCTION
  24338. æD FUNCTION AllocContig(refNum: INTEGER;VAR count: LONGINT): OSErr;
  24339. æDT myVariable := AllocContig(refNum,count);
  24340. æRT 218
  24341. æRI IV-143
  24342. æC 
  24343. AllocContig is a high-level function that calls PBAllocContig.
  24344.  
  24345. æKY HCreate
  24346. æFp Files.p
  24347. æT FUNCTION
  24348. æD FUNCTION HCreate(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;creator: OSType;
  24349.     fileType: OSType): OSErr;
  24350. æDT myVariable := HCreate(vRefNum,dirID,fileName,creator,fileType);
  24351. æRT 218
  24352. æRI IV-146, VI
  24353. æC 
  24354. HCreate creates a new file and sets the type and creator. It is an HFS version
  24355. of the MFS function Create.  vRefNum can hold a volume reference number or a
  24356. working directory reference number. dirID holds a directory ID.
  24357.  
  24358. HCreate calls the function PBHCreate, documented in the File Manager chapter of
  24359. Volume IV.
  24360.  
  24361. æKY DirCreate
  24362. æFp Files.p
  24363. æT FUNCTION
  24364. æD FUNCTION DirCreate(vRefNum: INTEGER;parentDirID: LONGINT;directoryName: Str255;
  24365.     VAR createdDirID: LONGINT): OSErr;
  24366. æDT myVariable := DirCreate(vRefNum,parentDirID,directoryName,createdDirID);
  24367. æRT 218
  24368. æRI IV-146
  24369. æC 
  24370. DirCreate is a high-level function that calls PBDirCreate.
  24371.  
  24372. æKY HDelete
  24373. æFp Files.p
  24374. æT FUNCTION
  24375. æD FUNCTION HDelete(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255): OSErr;
  24376. æDT myVariable := HDelete(vRefNum,dirID,fileName);
  24377. æRI IV-147
  24378. æC 
  24379.  
  24380. æKY HGetFInfo
  24381. æFp Files.p
  24382. æT FUNCTION
  24383. æD FUNCTION HGetFInfo(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;VAR fndrInfo: FInfo): OSErr;
  24384. æDT myVariable := HGetFInfo(vRefNum,dirID,fileName,fndrInfo);
  24385. æRI IV-149
  24386. æC 
  24387.  
  24388. æKY HSetFInfo
  24389. æFp Files.p
  24390. æT FUNCTION
  24391. æD FUNCTION HSetFInfo(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255;fndrInfo: FInfo): OSErr;
  24392. æDT myVariable := HSetFInfo(vRefNum,dirID,fileName,fndrInfo);
  24393. æRI IV-150
  24394. æC 
  24395.  
  24396. æKY HSetFLock
  24397. æFp Files.p
  24398. æT FUNCTION
  24399. æD FUNCTION HSetFLock(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255): OSErr;
  24400. æDT myVariable := HSetFLock(vRefNum,dirID,fileName);
  24401. æRI IV-151, VI
  24402. æC 
  24403. HSetFLock locks a file: no new access paths to it can be created. It is an HFS
  24404. version of the MFS function SetFLock. It calls the function PBHSetFLock,
  24405. documented in the File Manager chapter of Volume IV.
  24406.  
  24407. æKY HRstFLock
  24408. æFp Files.p
  24409. æT FUNCTION
  24410. æD FUNCTION HRstFLock(vRefNum: INTEGER;dirID: LONGINT;fileName: Str255): OSErr;
  24411. æDT myVariable := HRstFLock(vRefNum,dirID,fileName);
  24412. æRI IV-152, VI
  24413. æC 
  24414. HRstFLock unlocks a file. It is an HFS version of the MFS function RstFLock. It
  24415. calls the function PBHRstFLock, documented in the File Manager chapter of Volume
  24416. IV.
  24417.  
  24418. æKY HRename
  24419. æFp Files.p
  24420. æT FUNCTION
  24421. æD FUNCTION HRename(vRefNum: INTEGER;dirID: LONGINT;oldName: Str255;newName: Str255): OSErr;
  24422. æDT myVariable := HRename(vRefNum,dirID,oldName,newName);
  24423. æRI IV-154, VI
  24424. æC 
  24425. HRename changes the name of a file or directory. It is an HFS version of the MFS
  24426. function Rename. It calls the function PBHRename, documented in the File Manager
  24427. chapter of Volume IV.
  24428.  
  24429. æKY CatMove
  24430. æFp Files.p
  24431. æT FUNCTION
  24432. æD FUNCTION CatMove(vRefNum: INTEGER;dirID: LONGINT;oldName: Str255;newDirID: LONGINT;
  24433.     newName: Str255): OSErr;
  24434. æDT myVariable := CatMove(vRefNum,dirID,oldName,newDirID,newName);
  24435. æRT 218
  24436. æRI IV-157
  24437. æC 
  24438. CatMove is a high-level function that calls PBCatMove.
  24439.  
  24440. æKY OpenWD
  24441. æFp Files.p
  24442. æT FUNCTION
  24443. æD FUNCTION OpenWD(vRefNum: INTEGER;dirID: LONGINT;procID: LONGINT;VAR wdRefNum: INTEGER): OSErr;
  24444. æDT myVariable := OpenWD(vRefNum,dirID,procID,wdRefNum);
  24445. æRT 218
  24446. æRI IV-158
  24447. æC 
  24448. OpenWD is a high-level function that calls PBOpenWD.
  24449.  
  24450. æKY CloseWD
  24451. æFp Files.p
  24452. æT FUNCTION
  24453. æD FUNCTION CloseWD(wdRefNum: INTEGER): OSErr;
  24454. æDT myVariable := CloseWD(wdRefNum);
  24455. æRT 218
  24456. æRI IV-158
  24457. æC 
  24458. CloseWD is a high-level function that calls PBCloseWD.
  24459.  
  24460. æKY GetWDInfo
  24461. æFp Files.p
  24462. æT FUNCTION
  24463. æD FUNCTION GetWDInfo(wdRefNum: INTEGER;VAR vRefNum: INTEGER;VAR dirID: LONGINT;
  24464.     VAR procID: LONGINT): OSErr;
  24465. æDT myVariable := GetWDInfo(wdRefNum,vRefNum,dirID,procID);
  24466. æRT 218
  24467. æRI IV-159
  24468. æC 
  24469. GetWDInfo is a high-level function that calls PBGetWDInfo.
  24470.  
  24471. æKY PBExchangeFiles
  24472. æFp Files.p
  24473. æT FUNCTION
  24474. æD FUNCTION PBExchangeFiles(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24475. æDT myVariable := PBExchangeFiles(paramBlock,async);
  24476. æRI VI
  24477. æC
  24478. Parameter Block 
  24479. ¨   16  ioResult       word
  24480. Æ   18  ioNamePtr      string pointer
  24481. Æ   22  ioVRefNum      word
  24482. Æ   28  ioDestNamePtr  string pointer
  24483. Æ   36  ioDestDirID    long
  24484. Æ   48  ioSrcDirID     long
  24485.  
  24486. You should use PBExchangeFiles if your application needs to preserve the file ID
  24487. after moving the data into a new file. Typically, you use PBExchangeFiles after
  24488. creating a new file during a safe save. You must specify both files, which must
  24489. exist on the same volume. The file specified by [ioDestDirID, ioDestNamePtr] is
  24490. exchanged with the file specified by [ioSrcDirID, ioNamePtr]. Both forks of the
  24491. files are exchanged. Modification dates in the catalog record are exchanged,
  24492. along with the fields accessed by HFS to locate the data of the files. All other
  24493. catalog information remains unchanged.
  24494.  
  24495. PBExchangeFiles works on either open or closed files. If either file is open,
  24496. PBExchangeFiles updates any file control blocks associated with the file.
  24497.  
  24498. PBExchangeFiles does not require that file IDs exist for the files being
  24499. exchanged.
  24500.  
  24501. Result codes:
  24502.  
  24503. extFSErr          -58  External file system
  24504. ioErr             -36  I/O error
  24505. nsvErr            -35  No such volume
  24506. fnfErr            -43  File not found
  24507. fLckdErr          -45  One or both files locked
  24508. volOfflinErr      -53  Volume is off-line
  24509. wrgVolTypeErr    -123  Not an HFS volume
  24510. fidNotFoundErr  -1300  File not found
  24511. fidExists       -1301  File ID already exists
  24512. notAFileErr     -1302  Specified file is a directory
  24513. diffVolErr      -xxxx  Volume specifications in pathnames are not equivalent
  24514.  
  24515. æKY PBCreateFileID
  24516. æFp Files.p
  24517. æT FUNCTION
  24518. æD FUNCTION PBCreateFileID(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24519. æDT myVariable := PBCreateFileID(paramBlock,async);
  24520. æRI VI
  24521. æC 
  24522. Parameter Block 
  24523.   ¨   16  ioResult    word
  24524.   Æ   18  ioNamePtr   string pointer
  24525.   Æ   22  ioVRefNum   word
  24526.   Æ   48  ioSrcDirID  long
  24527.   ¨   54  ioFileID    long 
  24528.  
  24529. Given a volume reference number, file name, and parent directory ID,
  24530. PBCreateFileID creates a record to hold the name and parent directory ID of the
  24531. specified file. The actual value of the file ID is the same as the file number
  24532. stored in the file record. If a file ID already exists for the file, the ID
  24533. value is returned in ioFileID.
  24534.  
  24535. Result codes
  24536. extFSErr          -58  External file system
  24537. ioErr             -36  I/O error
  24538. nsvErr            -35  No such volume
  24539. volOfflinErr      -53  Volume is offline
  24540. vLckdErr          -46  Software volume lock
  24541. wPrErr            -44  Hardware volume lock
  24542. wrgVolTypeErr    -123  Not an HFS volume
  24543. fidNotFoundErr  -1300  File not found
  24544. fidExists       -1301  File ID already exists
  24545. notAFileErr     -1302  Specified file is a directory
  24546.  
  24547. æKY PBResolveFileID
  24548. æFp Files.p
  24549. æT FUNCTION
  24550. æD FUNCTION PBResolveFileID(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24551. æDT myVariable := PBResolveFileID(paramBlock,async);
  24552. æRI VI
  24553. æC 
  24554. Parameter Block 
  24555.   ¨   16  ioResult    word
  24556.   ´   18  ioNamePtr   string pointer
  24557.   Æ   22  ioVRefNum   word
  24558.   ¨   48  ioSrcDirID  long
  24559.   Æ   54  ioFileID    long 
  24560.  
  24561. PBResolveFileID returns the filename and parent directory ID of the file
  24562. referred to by file ID in the ioFileID field. It places the filename in the
  24563. string pointed to by ioNamePtr and the directory ID in ioSrcDirID. You must
  24564. allocate memory <how much?> for the string before you make the call. If the name
  24565. string is NIL, PBResolveFileID returns only the parent directory ID. If the name
  24566. string is not NIL but is only a volume name, PBResolveFileID ignores the value
  24567. in ioVRefNum, uses the volume name instead, and overwrites the name string with
  24568. the filename. A return code of fidNotFound means that the specified file ID has
  24569. become invalid either because the file was deleted or the file ID was destroyed
  24570. by PBDeleteFileID.
  24571.  
  24572. Result codes:
  24573.  
  24574. extFSErr          -58  External file system
  24575. ioErr             -36  I/O error
  24576. nsvErr            -35  No such volume
  24577. volOfflinErr      -53  Volume is off-line
  24578. wrgVolTypeErr    -123  Not an HFS volume
  24579. fidNotFoundErr  -1300  File ID not found
  24580. fidExists       -1301  File ID already exists
  24581. notAFileErr     -1302  Specified file is a directory
  24582.  
  24583. æKY PBDeleteFileID
  24584. æFp Files.p
  24585. æT FUNCTION
  24586. æD FUNCTION PBDeleteFileID(paramBlock: HParmBlkPtr;async: BOOLEAN): OSErr;
  24587. æDT myVariable := PBDeleteFileID(paramBlock,async);
  24588. æRI VI
  24589. æC 
  24590. Parameter Block 
  24591.   ¨   16  ioResult   word
  24592.   Æ   18  ioNamePtr  string pointer
  24593.   Æ   22  ioVRefNum  word
  24594.   Æ   54  ioFileID   long 
  24595.  
  24596. PBDeleteFileID invalidates a file ID on the volume specified by ioVRefNum or
  24597. ioNamePtr. After it has invalidated a file ID, the File Manager can no longer
  24598. resolve it to a filename and parent directory ID. The file ID is invalidated
  24599. whether or not the target file referenced by that ID still exists.
  24600.  
  24601. Result codes:
  24602.  
  24603. extFSErr          -58  External file system
  24604. ioErr             -36  I/O error
  24605. nsvErr            -35  No such volume
  24606. volOfflinErr      -53  Volume is offline
  24607. vLckdErr          -46  Software volume lock
  24608. wPrErr            -44  Hardware volume lock
  24609. wrgVolTypeErr    -123  Not an HFS volume
  24610. fidNotFoundErr  -1300  File ID not found
  24611. fidExists       -1301  File ID already exists
  24612. notAFileErr     -1302  Specified file is a directory
  24613.  
  24614. æKY PBDTGetPath
  24615. æFp Files.p
  24616. æT FUNCTION
  24617. æD FUNCTION PBDTGetPath(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24618. æDT myVariable := PBDTGetPath(paramBlock,async);
  24619. æC 
  24620.  
  24621. æKY PBDTCloseDown
  24622. æFp Files.p
  24623. æT FUNCTION
  24624. æD FUNCTION PBDTCloseDown(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24625. æDT myVariable := PBDTCloseDown(paramBlock,async);
  24626. æC 
  24627.  
  24628. æKY PBDTAddIcon
  24629. æFp Files.p
  24630. æT FUNCTION
  24631. æD FUNCTION PBDTAddIcon(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24632. æDT myVariable := PBDTAddIcon(paramBlock,async);
  24633. æC 
  24634.  
  24635. æKY PBDTGetIcon
  24636. æFp Files.p
  24637. æT FUNCTION
  24638. æD FUNCTION PBDTGetIcon(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24639. æDT myVariable := PBDTGetIcon(paramBlock,async);
  24640. æC 
  24641.  
  24642. æKY PBDTGetIconInfo
  24643. æFp Files.p
  24644. æT FUNCTION
  24645. æD FUNCTION PBDTGetIconInfo(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24646. æDT myVariable := PBDTGetIconInfo(paramBlock,async);
  24647. æC 
  24648.  
  24649. æKY PBDTAddAPPL
  24650. æFp Files.p
  24651. æT FUNCTION
  24652. æD FUNCTION PBDTAddAPPL(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24653. æDT myVariable := PBDTAddAPPL(paramBlock,async);
  24654. æC 
  24655.  
  24656. æKY PBDTRemoveAPPL
  24657. æFp Files.p
  24658. æT FUNCTION
  24659. æD FUNCTION PBDTRemoveAPPL(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24660. æDT myVariable := PBDTRemoveAPPL(paramBlock,async);
  24661. æC 
  24662.  
  24663. æKY PBDTGetAPPL
  24664. æFp Files.p
  24665. æT FUNCTION
  24666. æD FUNCTION PBDTGetAPPL(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24667. æDT myVariable := PBDTGetAPPL(paramBlock,async);
  24668. æC 
  24669.  
  24670. æKY PBDTSetComment
  24671. æFp Files.p
  24672. æT FUNCTION
  24673. æD FUNCTION PBDTSetComment(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24674. æDT myVariable := PBDTSetComment(paramBlock,async);
  24675. æC 
  24676.  
  24677. æKY PBDTRemoveComment
  24678. æFp Files.p
  24679. æT FUNCTION
  24680. æD FUNCTION PBDTRemoveComment(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24681. æDT myVariable := PBDTRemoveComment(paramBlock,async);
  24682. æC 
  24683.  
  24684. æKY PBDTGetComment
  24685. æFp Files.p
  24686. æT FUNCTION
  24687. æD FUNCTION PBDTGetComment(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24688. æDT myVariable := PBDTGetComment(paramBlock,async);
  24689. æC 
  24690.  
  24691. æKY PBDTFlush
  24692. æFp Files.p
  24693. æT FUNCTION
  24694. æD FUNCTION PBDTFlush(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24695. æDT myVariable := PBDTFlush(paramBlock,async);
  24696. æC 
  24697.  
  24698. æKY PBDTReset
  24699. æFp Files.p
  24700. æT FUNCTION
  24701. æD FUNCTION PBDTReset(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24702. æDT myVariable := PBDTReset(paramBlock,async);
  24703. æC 
  24704.  
  24705. æKY PBDTGetInfo
  24706. æFp Files.p
  24707. æT FUNCTION
  24708. æD FUNCTION PBDTGetInfo(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24709. æDT myVariable := PBDTGetInfo(paramBlock,async);
  24710. æC 
  24711.  
  24712. æKY PBDTOpenInform
  24713. æFp Files.p
  24714. æT FUNCTION
  24715. æD FUNCTION PBDTOpenInform(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24716. æDT myVariable := PBDTOpenInform(paramBlock,async);
  24717. æC 
  24718.  
  24719. æKY PBDTDelete
  24720. æFp Files.p
  24721. æT FUNCTION
  24722. æD FUNCTION PBDTDelete(paramBlock: DTPBPtr;async: BOOLEAN): OSErr;
  24723. æDT myVariable := PBDTDelete(paramBlock,async);
  24724. æC 
  24725.  
  24726. æKY MakeFSSpec
  24727. æFp Files.p
  24728. æT FUNCTION
  24729. æD 
  24730. {  FSSpec Glue  }
  24731. FUNCTION MakeFSSpec(vRefNum: INTEGER;dirID: LONGINT;fileName: StringPtr): OSErr;
  24732. æDT myVariable := MakeFSSpec(vRefNum,dirID,fileName);
  24733. æRI VI
  24734. æC 
  24735. You use the MakeFSSpec function to establish the canonical form of the name for
  24736. a file, folder, or volume.
  24737.  
  24738. MakeFSSpec places the canonical form of the specified file reference in the
  24739. CanonicalFileSpec parameter. (See “Identifying Files, Folders, and Volumes” for
  24740. a description of the FSSpec record.)
  24741.  
  24742. The vRefNum parameter is the volume reference number, a working directory
  24743. reference number, a drive number, or 0 for the default volume.
  24744.  
  24745. The dirID parameter is the parent directory ID of the target object. If the
  24746. directory is sufficiently specified by either vRefNum or fileName, dirID can be
  24747. 0. If you explicitly specify dirID (that is, if it is any value other than 0),
  24748. and if vRefNum is a working directory reference number, dirID overrides the
  24749. directory ID included in vRefNum.
  24750.  
  24751. The fileName parameter is a full or partial pathname. If it is a full pathname,
  24752. MakeFSSpec ignores vRefNum and dirID. A partial pathname might identify only the
  24753. final target, or it might include one or more parent folder names. If fileName
  24754. is a partial pathname, vRefNum, dirID, or both must be valid.
  24755.  
  24756. You can pass the input to MakeFSSpec in any of the four ways described in 
  24757. “Identifying Files, Folders, and Volumes” earlier in this chapter. See “Using
  24758. the File Manager” for a summary of the how MakeFSSpec accepts input and how it
  24759. fills in the FSSpec record for files, folders, and volumes.
  24760.  
  24761. In addition to the result code listed here, MakeFSSpec can return a number of
  24762. different File Manager or Memory Manager error codes.
  24763.  
  24764. Result codes
  24765. paramErr  -50  Output is NIL
  24766.  
  24767. æKY FSpOpenDF
  24768. æFp Files.p
  24769. æT FUNCTION
  24770. æD FUNCTION FSpOpenDF(spec: FSSpecPtr;permission: Byte;VAR refNum: INTEGER): OSErr;
  24771. æDT myVariable := FSpOpenDF(spec,permission,refNum);
  24772. æC 
  24773.  
  24774. æKY FSpOpenRF
  24775. æFp Files.p
  24776. æT FUNCTION
  24777. æD FUNCTION FSpOpenRF(spec: FSSpecPtr;permission: Byte;VAR refNum: INTEGER): OSErr;
  24778. æDT myVariable := FSpOpenRF(spec,permission,refNum);
  24779. æC 
  24780.  
  24781. æKY FSpCreate
  24782. æFp Files.p
  24783. æT FUNCTION
  24784. æD FUNCTION FSpCreate(spec: FSSpecPtr;creator: OSType;fileType: OSType): OSErr;
  24785. æDT myVariable := FSpCreate(spec,creator,fileType);
  24786. æC 
  24787.  
  24788. æKY FSpDirCreate
  24789. æFp Files.p
  24790. æT FUNCTION
  24791. æD FUNCTION FSpDirCreate(spec: FSSpecPtr;VAR createdDirID: LONGINT): OSErr;
  24792. æDT myVariable := FSpDirCreate(spec,createdDirID);
  24793. æC 
  24794.  
  24795. æKY FSpDelete
  24796. æFp Files.p
  24797. æT FUNCTION
  24798. æD FUNCTION FSpDelete(spec: FSSpecPtr): OSErr;
  24799. æDT myVariable := FSpDelete(spec);
  24800. æC 
  24801.  
  24802. æKY FSpGetFInfo
  24803. æFp Files.p
  24804. æT FUNCTION
  24805. æD FUNCTION FSpGetFInfo(spec: FSSpecPtr;VAR fndrInfo: FInfo): OSErr;
  24806. æDT myVariable := FSpGetFInfo(spec,fndrInfo);
  24807. æC 
  24808.  
  24809. æKY FSpSetFInfo
  24810. æFp Files.p
  24811. æT FUNCTION
  24812. æD FUNCTION FSpSetFInfo(spec: FSSpecPtr;VAR fndrInfo: FInfo): OSErr;
  24813. æDT myVariable := FSpSetFInfo(spec,fndrInfo);
  24814. æC 
  24815.  
  24816. æKY FSpSetFLock
  24817. æFp Files.p
  24818. æT FUNCTION
  24819. æD FUNCTION FSpSetFLock(spec: FSSpecPtr): OSErr;
  24820. æDT myVariable := FSpSetFLock(spec);
  24821. æC 
  24822.  
  24823. æKY FSpRstFLock
  24824. æFp Files.p
  24825. æT FUNCTION
  24826. æD FUNCTION FSpRstFLock(spec: FSSpecPtr): OSErr;
  24827. æDT myVariable := FSpRstFLock(spec);
  24828. æC 
  24829.  
  24830. æKY FSpRename
  24831. æFp Files.p
  24832. æT FUNCTION
  24833. æD FUNCTION FSpRename(spec: FSSpecPtr;newName: StringPtr): OSErr;
  24834. æDT myVariable := FSpRename(spec,newName);
  24835. æC 
  24836.  
  24837. æKY FSpCatMove
  24838. æFp Files.p
  24839. æT FUNCTION
  24840. æD FUNCTION FSpCatMove(source: FSSpecPtr;dest: FSSpecPtr): OSErr;
  24841. æDT myVariable := FSpCatMove(source,dest);
  24842. æC 
  24843.  
  24844. æKY FSpOpenResFile
  24845. æFp Files.p
  24846. æT FUNCTION
  24847. æD FUNCTION FSpOpenResFile(spec: FSSpecPtr;permission: Byte): INTEGER;
  24848. æDT myVariable := FSpOpenResFile(spec,permission);
  24849. æC 
  24850.  
  24851. æKY FSpCreateResFile
  24852. æFp Files.p
  24853. æT PROCEDURE
  24854. æD PROCEDURE FSpCreateResFile(spec: FSSpecPtr);
  24855. æDT FSpCreateResFile(spec);
  24856. æC 
  24857.  
  24858.  
  24859. æKY FixMath.p
  24860. æKL Fix2Frac
  24861. Fix2Long
  24862. Fix2X
  24863. FixATan2
  24864. FixDiv
  24865. Frac2Fix
  24866. Frac2X
  24867. FracCos
  24868. FracDiv
  24869. FracMul
  24870. FracSin
  24871. FracSqrt
  24872. Long2Fix
  24873. X2Fix
  24874. X2Frac
  24875.  
  24876.  
  24877. æKY Fix2Frac
  24878. æFp FixMath.p
  24879. æT FUNCTION
  24880. æTN A841
  24881. æD FUNCTION Fix2Frac(x: Fixed): Fract;
  24882.     INLINE $A841;
  24883. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point
  24884. types.
  24885.  }
  24886. æDT myVariable := Fix2Frac(x);
  24887. æRI IV-65
  24888. æC 
  24889. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point types.
  24890.  
  24891. Examples
  24892.  
  24893. Examples of the use of these fixed-point functions are provided below; all numbers
  24894. are decimal unless otherwise noted.
  24895.  
  24896. Function                                 Result      Comment
  24897. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  24898. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  24899. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  24900. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  24901. FracSin   (X2Fix(3.1416015625))          $00000000    0
  24902. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  24903. Fix2Long  (X2Fix(1.75))                  $00000002    2
  24904. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  24905. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  24906. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  24907. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  24908. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  24909. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  24910. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  24911. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  24912. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  24913. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  24914. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  24915. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  24916.  
  24917. æKY Fix2Long
  24918. æFp FixMath.p
  24919. æT FUNCTION
  24920. æTN A840
  24921. æD FUNCTION Fix2Long(x: Fixed): LONGINT;
  24922.     INLINE $A840;
  24923. æDT myVariable := Fix2Long(x);
  24924. æRI IV-65
  24925. æC 
  24926. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point types.
  24927.  
  24928. Examples
  24929.  
  24930. Examples of the use of these fixed-point functions are provided below; all numbers
  24931. are decimal unless otherwise noted.
  24932.  
  24933. Function                                 Result      Comment
  24934. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  24935. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  24936. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  24937. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  24938. FracSin   (X2Fix(3.1416015625))          $00000000    0
  24939. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  24940. Fix2Long  (X2Fix(1.75))                  $00000002    2
  24941. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  24942. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  24943. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  24944. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  24945. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  24946. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  24947. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  24948. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  24949. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  24950. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  24951. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  24952. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  24953.  
  24954. æKY FixATan2
  24955. æFp FixMath.p
  24956. æT FUNCTION
  24957. æTN A818
  24958. æD FUNCTION FixATan2(x: LONGINT;y: LONGINT): Fixed;
  24959.     INLINE $A818;
  24960. æDT myVariable := FixATan2(x,y);
  24961. æRI IV-65
  24962. æC 
  24963. FixATan2 returns the arctangent of y / x in radians. Note that FixATan2 effects
  24964. “arctan(type / type) --> Fixed”:
  24965.  
  24966.   arctan(LONGINT / LONGINT)  -->    Fixed
  24967.   arctan(Fixed / Fixed)      -->    Fixed
  24968.   arctan(Fract / Fract)      -->    Fixed
  24969.  
  24970. æKY Long2Fix
  24971. æFp FixMath.p
  24972. æT FUNCTION
  24973. æTN A83F
  24974. æD FUNCTION Long2Fix(x: LONGINT): Fixed;
  24975.     INLINE $A83F;
  24976. æDT myVariable := Long2Fix(x);
  24977. æRI IV-65
  24978. æC 
  24979. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point types.
  24980.  
  24981. Examples
  24982.  
  24983. Examples of the use of these fixed-point functions are provided below; all numbers
  24984. are decimal unless otherwise noted.
  24985.  
  24986. Function                                 Result      Comment
  24987. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  24988. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  24989. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  24990. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  24991. FracSin   (X2Fix(3.1416015625))          $00000000    0
  24992. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  24993. Fix2Long  (X2Fix(1.75))                  $00000002    2
  24994. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  24995. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  24996. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  24997. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  24998. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  24999. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  25000. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  25001. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  25002. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  25003. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  25004. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  25005. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  25006.  
  25007. æKY Frac2Fix
  25008. æFp FixMath.p
  25009. æT FUNCTION
  25010. æTN A842
  25011. æD FUNCTION Frac2Fix(x: Fract): Fixed;
  25012.     INLINE $A842;
  25013. æDT myVariable := Frac2Fix(x);
  25014. æRI IV-65
  25015. æC 
  25016. Long2Fix, Fix2Long, Fix2Frac, and Frac2Fix convert between fixed-point types.
  25017.  
  25018. Examples
  25019.  
  25020. Examples of the use of these fixed-point functions are provided below; all numbers
  25021. are decimal unless otherwise noted.
  25022.  
  25023. Function                                 Result      Comment
  25024. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  25025. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  25026. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  25027. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  25028. FracSin   (X2Fix(3.1416015625))          $00000000    0
  25029. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  25030. Fix2Long  (X2Fix(1.75))                  $00000002    2
  25031. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  25032. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  25033. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  25034. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  25035. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  25036. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  25037. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  25038. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  25039. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  25040. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  25041. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  25042. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  25043.  
  25044. æKY Frac2X
  25045. æFp FixMath.p
  25046. æT FUNCTION
  25047. æD FUNCTION Frac2X(x: Fract): extended;
  25048. æDT myVariable := Frac2X(x);
  25049. æRI IV-65
  25050. æC 
  25051. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract and the Extended
  25052. floating-point type. These functions do not set floating-point exception flags.
  25053.  
  25054. Examples
  25055.  
  25056. Examples of the use of these fixed-point functions are provided below; all numbers
  25057. are decimal unless otherwise noted.
  25058.  
  25059. Function                                 Result      Comment
  25060. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  25061. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  25062. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  25063. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  25064. FracSin   (X2Fix(3.1416015625))          $00000000    0
  25065. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  25066. Fix2Long  (X2Fix(1.75))                  $00000002    2
  25067. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  25068. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  25069. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  25070. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  25071. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  25072. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  25073. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  25074. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  25075. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  25076. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  25077. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  25078. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  25079.  
  25080. æKY Fix2X
  25081. æFp FixMath.p
  25082. æT FUNCTION
  25083. æD FUNCTION Fix2X(x: Fixed): extended;
  25084. æDT myVariable := Fix2X(x);
  25085. æRI IV-65
  25086. æC 
  25087. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract and the Extended
  25088. floating-point type. These functions do not set floating-point exception flags.
  25089.  
  25090. Examples
  25091.  
  25092. Examples of the use of these fixed-point functions are provided below; all numbers
  25093. are decimal unless otherwise noted.
  25094.  
  25095. Function                                 Result      Comment
  25096. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  25097. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  25098. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  25099. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  25100. FracSin   (X2Fix(3.1416015625))          $00000000    0
  25101. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  25102. Fix2Long  (X2Fix(1.75))                  $00000002    2
  25103. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  25104. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  25105. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  25106. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  25107. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  25108. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  25109. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  25110. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  25111. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  25112. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  25113. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  25114. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  25115.  
  25116. æKY X2Fix
  25117. æFp FixMath.p
  25118. æT FUNCTION
  25119. æD FUNCTION X2Fix(x: extended): Fixed;
  25120. æDT myVariable := X2Fix(x);
  25121. æRI IV-65
  25122. æC 
  25123. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract and the Extended
  25124. floating-point type. These functions do not set floating-point exception flags.
  25125.  
  25126. Examples
  25127.  
  25128. Examples of the use of these fixed-point functions are provided below; all numbers
  25129. are decimal unless otherwise noted.
  25130.  
  25131. Function                                 Result      Comment
  25132. FixDiv    (X2Fix(1.95), X2Fix(1.30))     $00018000    1.5 = 01.10 bin
  25133. FracDiv   (X2Frac(1.95), X2Frac(1.30))   $60000000    1.5 = 01.10 bin
  25134. FracMul   (X2Frac(1.50), X2Frac(1.30))   $7CCCCCCD    1.95 rounded
  25135. FracSqrt  (X2Frac(1.96))                 $5999999A    1.4 rounded
  25136. FracSin   (X2Fix(3.1416015625))          $00000000    0
  25137. FracCos   (X2Fix(3.1416015625))          $C0000000   -1
  25138. Fix2Long  (X2Fix(1.75))                  $00000002    2
  25139. Fix2Frac  (X2Fix(1.75))                  $70000000    1.75 = 01.11 bin
  25140. Frac2Fix  (X2Frac(1.75))                 $0001C000    1.75 = 01.11 bin
  25141. FixATan2  (X2Fix(1.00), X2Fix(1.00))     $0000C910    0.C910 hex = X2Fix (π/4)
  25142. FixDiv    (X2Fix(-1.95), X2Fix(1.30))    $FFFE8000   -1.5
  25143. FracDiv   (X2Frac(-1.95), X2Frac(1.30))  $A0000000   -1.5
  25144. FracMul   (X2Frac(-1.50), X2Frac(1.30))  $83333333   -1.95 rounded
  25145. FracSin   (X2Fix(-3.1416015625))         $00000000    0
  25146. FracCos   (X2Fix(-3.1416015625))         $C0000000   -1
  25147. Fix2Long  (X2Fix(-1.75))                 $FFFFFFFE   -2
  25148. Fix2Frac  (X2Fix(-1.75))                 $90000000   -1.75
  25149. Frac2Fix  (X2Frac(-1.75))                $FFFE4000   -1.75
  25150. FixATan2  (X2Fix(-1.00), X2Fix(-1.00))   $FFFDA4D0   -3*X2Fix(π/4)=3*0.C910 hex
  25151.  
  25152. æKY X2Frac
  25153. æFp FixMath.p
  25154. æT FUNCTION
  25155. æD FUNCTION X2Frac(x: extended): Fract;
  25156. æDT myVariable := X2Frac(x);
  25157. æRI X2Frac function  IV-65
  25158.  
  25159. æC FUNCTION X2Frac (x: Extended) : Fract;
  25160.  
  25161. Fix2X, X2Fix, Frac2X, and X2Frac convert between Fixed and Fract
  25162. and the Extended floating-point type. These functions do not set
  25163. floating-point exception flags.
  25164.  
  25165.  
  25166.  
  25167. æKY FracMul
  25168. æFp FixMath.p
  25169. æT FUNCTION
  25170. æTN A84A
  25171. æD FUNCTION FracMul(x: Fract;y: Fract): Fract;
  25172.     INLINE $A84A;
  25173. æDT myVariable := FracMul(x,y);
  25174. æRI IV-64
  25175. æC 
  25176. FracMul returns x * y. Note that FracMul effects “type * Fract --> type”:
  25177.  
  25178.   Fract    *    Fract    -->    Fract
  25179.   LONGINT  *    Fract    -->    LONGINT
  25180.   Fract    *    LONGINT  -->    LONGINT
  25181.   Fixed    *    Fract    -->    Fixed
  25182.   Fract    *    Fixed    -->    Fixed
  25183.  
  25184. æKY FixDiv
  25185. æFp FixMath.p
  25186. æT FUNCTION
  25187. æTN A84D
  25188. æD FUNCTION FixDiv(x: Fixed;y: Fixed): Fixed;
  25189.     INLINE $A84D;
  25190. æDT myVariable := FixDiv(x,y);
  25191. æRI IV-64
  25192. æC 
  25193. FixDiv returns x / y. Note that FixDiv effects “type / type --> Fixed” and
  25194. “type / Fixed --> type”:
  25195.  
  25196.   Fixed    /    Fixed    -->    Fixed
  25197.   LONGINT  /    LONGINT  -->    Fixed
  25198.   Fract    /    Fract    -->    Fixed
  25199.   LONGINT  /    Fixed    -->    LONGINT
  25200.   Fract    /    Fixed    -->    Fract
  25201.  
  25202. æKY FracDiv
  25203. æFp FixMath.p
  25204. æT FUNCTION
  25205. æTN A84B
  25206. æD FUNCTION FracDiv(x: Fract;y: Fract): Fract;
  25207.     INLINE $A84B;
  25208. æDT myVariable := FracDiv(x,y);
  25209. æRI IV-64
  25210. æC 
  25211. FracDiv returns x / y. Note that FracDiv effects “type / type --> Fract” and
  25212. “type / Fract --> type”:
  25213.  
  25214.   Fract    /    Fract    -->    Fract
  25215.   LONGINT  /    LONGINT  -->    Fract
  25216.   Fixed    /    Fixed    -->    Fract
  25217.   LONGINT  /    Fract    -->    LONGINT
  25218.   Fixed    /    Fract    -->    Fixed
  25219.  
  25220. æKY FracSqrt
  25221. æFp FixMath.p
  25222. æT FUNCTION
  25223. æTN A849
  25224. æD FUNCTION FracSqrt(x: Fract): Fract;
  25225.     INLINE $A849;
  25226. æDT myVariable := FracSqrt(x);
  25227. æRI IV-64
  25228. æC  
  25229. FracSqrt returns the square root of x, with x interpreted as unsigned in the range 0
  25230. through 4–(2–30), inclusive:  That is, bit 15 in Figure 1 has weight 2 rather than
  25231. –2. The result, too, is unsigned in the range 0 through 2, inclusive.
  25232.  
  25233. æKY FracSin
  25234. æFp FixMath.p
  25235. æT FUNCTION
  25236. æTN A848
  25237. æD FUNCTION FracSin(x: Fixed): Fract;
  25238.     INLINE $A848;
  25239. æDT myVariable := FracSin(x);
  25240. æRI IV-64
  25241. æC 
  25242. FracCos and FracSin return the cosine and sine of their radian arguments, respectively.
  25243. The hexadecimal value 0.C910 (which is FixATan2(1,1)) is the approximation to π/4
  25244. used for argument reduction. Thus, FracCos and FracSin are nearly periodic, but with
  25245. period 2*P instead of 2*π, where P=3.1416015625 and π, of course, is 3.14159265....
  25246.  
  25247. æKY FracCos
  25248. æFp FixMath.p
  25249. æT FUNCTION
  25250. æTN A847
  25251. æD FUNCTION FracCos(x: Fixed): Fract;
  25252.     INLINE $A847;
  25253. æDT myVariable := FracCos(x);
  25254. æRI IV-64
  25255. æC 
  25256. FracCos and FracSin return the cosine and sine of their radian arguments, respectively.
  25257. The hexadecimal value 0.C910 (which is FixATan2(1,1)) is the approximation to π/4
  25258. used for argument reduction. Thus, FracCos and FracSin are nearly periodic, but with
  25259. period 2*P instead of 2*π, where P=3.1416015625 and π, of course, is 3.14159265....
  25260.  
  25261.  
  25262. æKY Folders.p
  25263. æKL FindFolder
  25264.  
  25265. kAppleMenuFolderType
  25266. kControlPanelFolderType
  25267. kCreateFolder
  25268. kDesktopFolderType
  25269. kDontCreateFolder
  25270. kExtensionFolderType
  25271. kOnSystemDisk
  25272. kPreferencesFolderType
  25273. kSpoolFolderType
  25274. kStartupFolderType
  25275. kSystemFolderType
  25276. kTemporaryFolderType
  25277. kTrashFolderType
  25278. kWhereToEmptyTrashFolderType
  25279.  
  25280. æKY kOnSystemDisk
  25281. æFp Folders.p
  25282. æT CONST
  25283. æD kOnSystemDisk = $8000;
  25284. æC 
  25285.  
  25286. æKY kCreateFolder
  25287. æFp Folders.p
  25288. æT CONST
  25289. æD kCreateFolder = TRUE;
  25290. æC 
  25291.  
  25292. æKY kDontCreateFolder
  25293. æFp Folders.p
  25294. æT CONST
  25295. æD kDontCreateFolder = FALSE;
  25296. æC 
  25297.  
  25298. æKY kSystemFolderType
  25299. æFp Folders.p
  25300. æT CONST
  25301. æD kSystemFolderType = 'macs'; {the system folder}
  25302. æC 
  25303.  
  25304. æKY kDesktopFolderType
  25305. æFp Folders.p
  25306. æT CONST
  25307. æD kDesktopFolderType = 'desk'; {the desktop folder; objects in this folder show on the desk top.}
  25308. æC 
  25309.  
  25310. æKY kTrashFolderType
  25311. æFp Folders.p
  25312. æT CONST
  25313. æD kTrashFolderType = 'trsh'; {the trash folder; objects in this folder show up in the trash}
  25314. æC 
  25315.  
  25316. æKY kWhereToEmptyTrashFolderType
  25317. æFp Folders.p
  25318. æT CONST
  25319. æD kWhereToEmptyTrashFolderType = 'empt'; {the "empty trash" folder; Finder starts empty from here down}
  25320. æC 
  25321.  
  25322. æKY kSpoolFolderType
  25323. æFp Folders.p
  25324. æT CONST
  25325. æD kSpoolFolderType = 'spoo'; {spool files go here (from the print drivers to the despooler}
  25326. æC 
  25327.  
  25328. æKY kStartupFolderType
  25329. æFp Folders.p
  25330. æT CONST
  25331. æD kStartupFolderType = 'strt'; {Finder objects (applications, documents, DAs, aliases, to...) to open at startup go here}
  25332. æC 
  25333.  
  25334. æKY kAppleMenuFolderType
  25335. æFp Folders.p
  25336. æT CONST
  25337. æD kAppleMenuFolderType = 'amnu'; {Finder objects to put into the Apple menu go here}
  25338. æC 
  25339.  
  25340. æKY kControlPanelFolderType
  25341. æFp Folders.p
  25342. æT CONST
  25343. æD kControlPanelFolderType = 'ctrl'; {Control Panels go here (may contain INITs)}
  25344. æC 
  25345.  
  25346. æKY kExtensionFolderType
  25347. æFp Folders.p
  25348. æT CONST
  25349. æD kExtensionFolderType = 'extn'; {Finder extensions go here}
  25350. æC 
  25351.  
  25352. æKY kPreferencesFolderType
  25353. æFp Folders.p
  25354. æT CONST
  25355. æD kPreferencesFolderType = 'pref'; {preferences for applications go here}
  25356. æC 
  25357.  
  25358. æKY kTemporaryFolderType
  25359. æFp Folders.p
  25360. æT CONST
  25361. æD kTemporaryFolderType = 'temp'; {temporary files go here (deleted periodically, but don't rely on it.)}
  25362. æC 
  25363.  
  25364. æKY FindFolder
  25365. æFp Folders.p
  25366. æT FUNCTION
  25367. æD FUNCTION FindFolder(vRefNum: INTEGER;folderType: OSType;createFolder: Boolean ;
  25368.     VAR foundVRefNum: INTEGER;VAR foundDirID: LONGINT): OSErr;
  25369.     INLINE $7000,$A823;
  25370. æDT myVariable := FindFolder(vRefNum,folderType,createFolder,foundVRefNum,foundDirID);
  25371. æC 
  25372. You can call the FindFolder function to get the path information so that you can
  25373. access special folders. You pass FindFolder a target volume and a constant that
  25374. tells it which special folder you are interested in. FindFolder returns a volume
  25375. reference number and a directory ID. If the specified folder does not exist,
  25376. FindFolder can create it and return the new directory ID.
  25377.  
  25378. The Finder identifies the folder types and their names in a resource of type 
  25379. 'fld#'. Table 8-2 lists the folder types in version 7.0, their resource types,
  25380. and the constants that represent them.
  25381.  
  25382. Table 8-2.  Special folders
  25383.  
  25384. Folder                Type    Constant
  25385.  
  25386. System Folder         'macs'  kSystemFolderType
  25387. Extensions folder     'extn'  kExtensionFolderType
  25388. Preferences folder    'pref'  kPreferencesFolderType
  25389. Apple Menu Folder     'amnu'  kAppleMenuFolderType
  25390. Startup Folder        'strt'  kStartupFolderType
  25391. Print Monitor Folder  'spoo'  kSpoolFolderType
  25392. Temporary folder      'temp'  kTemporaryFolderType
  25393. Desktop folder        'desk'  kDesktopFolderType
  25394. Single-user
  25395.     trash folder      'trsh'  kTrashFolderType
  25396. Shared trash folder   'empt'  kSharedTrashFolderType
  25397.  
  25398. In calls to FindFolder, you can use these three constants:
  25399.  
  25400. CONST
  25401. kOnSystemDisk = $8000;
  25402. kCreateFolder = TRUE;
  25403. kDontCreateFolder = FALSE;
  25404.  
  25405. Call the FindFolder function to get a volume and directory ID for a special
  25406. folder.
  25407.  
  25408. FUNCTION FindFolder (vRefNum: Integer; folderType: OSType; createFolder:
  25409.                      Boolean; VAR foundVRefNum: Integer; VAR foundDirID:
  25410.                      LongInt) : OSErr;
  25411.  
  25412. The FindFolder function returns the volume reference number and directory ID of
  25413. a specified special folder on a specified volume. You specify a volume reference
  25414. number (or the constant kOnSystemDisk for the boot disk) in the vRefNum
  25415. parameter. You specify the folder type in the folderType parameter, using one of
  25416. the constants listed in Table 8-2. The createFolder parameter tells FindFolder
  25417. whether or not to create a folder if it does not already exist. FindFolder puts
  25418. the results in foundVRefNum and foundDirID.
  25419.  
  25420. Result codes
  25421. fnfErr  -43     Type not found in 'fld# resource;
  25422.                 Folder not found and createFolder flag false
  25423. dupFNErr  -48   File found instead of folder
  25424.  
  25425. æKY Fonts.p
  25426. æKL FMSwapFont
  25427. FontMetrics
  25428. GetFNum
  25429. GetFontName
  25430. InitFonts
  25431. RealFont
  25432. SetFontLock
  25433. SetFractEnable
  25434. SetFScaleDisable
  25435.  
  25436. appleMark
  25437. applFont
  25438. AsscEntry
  25439. athens
  25440. cairo
  25441. checkMark
  25442. commandMark
  25443. courier
  25444. diamondMark
  25445. FamRec
  25446. fixedFont
  25447. FMetricRec
  25448. FMInput
  25449. FMOutPtr
  25450. FMOutput
  25451. FontAssoc
  25452. FontRec
  25453. fontWid
  25454. fxdFntH
  25455. fxdFntHW
  25456. fxdFntW
  25457. geneva
  25458. helvetica
  25459. KernEntry
  25460. KernPair
  25461. KernTable
  25462. london
  25463. losAngeles
  25464. mobile
  25465. monaco
  25466. NameTable
  25467. newYork
  25468. propFont
  25469. prpFntH
  25470. prpFntHW
  25471. prpFntW
  25472. sanFran
  25473. StyleTable
  25474. symbol
  25475. systemFont
  25476. times
  25477. toronto
  25478. venice
  25479. WidEntry
  25480. WidTable
  25481. WidthTable
  25482.  
  25483. æKY systemFont
  25484. æFp Fonts.p
  25485. æT CONST
  25486. æD systemFont = 0;
  25487. æC 
  25488. _______________________________________________________________________________
  25489.  
  25490. »FONT NUMBERS
  25491. _______________________________________________________________________________
  25492.  
  25493. Note:  The information on Font Numbers described in the following
  25494.        paragraphs was originally documented in Inside Macintosh, Volume I.
  25495.  
  25496. The Font Manager includes the following font numbers for identifying system-defined
  25497. fonts:
  25498.  
  25499. CONST  systemFont  = 0;    {system font}
  25500.        applFont    = 1;    {application font}
  25501.        newYork     = 2;
  25502.        geneva      = 3;
  25503.        monaco      = 4;
  25504.        venice      = 5;
  25505.        london      = 6;
  25506.        athens      = 7;
  25507.        sanFran     = 8;
  25508.        toronto     = 9;
  25509.        cairo       = 11;
  25510.        losAngeles  = 12;
  25511.        times       = 20;
  25512.        helvetica   = 21;
  25513.        courier     = 22;
  25514.        symbol      = 23;
  25515.        taliesin    = 24;
  25516.  
  25517. The system font is so called because it’s the font used by the system (for drawing
  25518. menu titles and commands in menus, for example). The name of the system font is
  25519. Chicago. The size of text drawn by the system in this font is fixed at 12 points
  25520. (called the system font size).
  25521.  
  25522. The application font is the font your application will use unless you specify otherwise.
  25523. Unlike the system font, the application font isn’t a separate font, but is essentially
  25524. a reference to another font—Geneva, by default. (The application font number is
  25525. determined by a value that you can set in parameter RAM; see the Operating System
  25526. Utilities chapter for more information.)
  25527.  
  25528. Assembly-language note:  You can get the application font number
  25529.                          from the global variable ApFontID.
  25530.  
  25531. æKY applFont
  25532. æFp Fonts.p
  25533. æT CONST
  25534. æD applFont = 1;
  25535. æC 
  25536.  
  25537. æKY newYork
  25538. æFp Fonts.p
  25539. æT CONST
  25540. æD newYork = 2;
  25541. æC 
  25542.  
  25543. æKY geneva
  25544. æFp Fonts.p
  25545. æT CONST
  25546. æD geneva = 3;
  25547. æC 
  25548.  
  25549. æKY monaco
  25550. æFp Fonts.p
  25551. æT CONST
  25552. æD monaco = 4;
  25553. æC 
  25554.  
  25555. æKY venice
  25556. æFp Fonts.p
  25557. æT CONST
  25558. æD venice = 5;
  25559. æC 
  25560.  
  25561. æKY london
  25562. æFp Fonts.p
  25563. æT CONST
  25564. æD london = 6;
  25565. æC 
  25566.  
  25567. æKY athens
  25568. æFp Fonts.p
  25569. æT CONST
  25570. æD athens = 7;
  25571. æC 
  25572.  
  25573. æKY sanFran
  25574. æFp Fonts.p
  25575. æT CONST
  25576. æD sanFran = 8;
  25577. æC 
  25578.  
  25579. æKY toronto
  25580. æFp Fonts.p
  25581. æT CONST
  25582. æD toronto = 9;
  25583. æC 
  25584.  
  25585. æKY cairo
  25586. æFp Fonts.p
  25587. æT CONST
  25588. æD cairo = 11;
  25589. æC 
  25590.  
  25591. æKY losAngeles
  25592. æFp Fonts.p
  25593. æT CONST
  25594. æD losAngeles = 12;
  25595. æC 
  25596.  
  25597. æKY times
  25598. æFp Fonts.p
  25599. æT CONST
  25600. æD times = 20;
  25601. æC 
  25602.  
  25603. æKY helvetica
  25604. æFp Fonts.p
  25605. æT CONST
  25606. æD helvetica = 21;
  25607. æC 
  25608.  
  25609. æKY courier
  25610. æFp Fonts.p
  25611. æT CONST
  25612. æD courier = 22;
  25613. æC 
  25614.  
  25615. æKY symbol
  25616. æFp Fonts.p
  25617. æT CONST
  25618. æD symbol = 23;
  25619. æC 
  25620.  
  25621. æKY mobile
  25622. æFp Fonts.p
  25623. æT CONST
  25624. æD mobile = 24;
  25625. æC 
  25626.  
  25627. æKY commandMark
  25628. æFp Fonts.p
  25629. æT CONST
  25630. æD commandMark = 17;
  25631. æC 
  25632. _______________________________________________________________________________
  25633. »CHARACTERS IN A FONT
  25634. _______________________________________________________________________________
  25635.  
  25636. Note:  The information on the Characters In A Font described in the following
  25637.        paragraphs was originally documented in Inside Macintosh, Volume I.
  25638.  
  25639. A font can consist of up to 255 distinct characters; not all characters need to be
  25640. defined in a single font. Figure 20 shows the standard printing characters on the
  25641. Macintosh and their ASCII codes (for example, the ASCII code for “A” is 41 hexadecimal,
  25642. or 65 decimal).
  25643.  
  25644. Note:  Codes $00 through $1F and code $7F are normally nonprinting
  25645.        characters (see the Toolbox Event Manager chapter for details).
  25646.  
  25647. The special characters in the system font with codes $11 through $14 can’t normally
  25648. be typed from the keyboard or keypad. The Font Manager defines constants for these
  25649. characters:
  25650.  
  25651. CONST  commandMark  = $11;    {Command key symbol}
  25652.        checkMark    = $12;    {check mark}
  25653.        diamondMark  = $13;    {diamond symbol}
  25654.        appleMark    = $14;    {apple symbol}
  25655.  
  25656. In addition to its maximum of 255 characters, every font contains a missing symbol
  25657. that’s drawn in case of a request to draw a character that’s missing from the font.
  25658.  
  25659. •••Refer to Figure 20.•••
  25660.  
  25661. Figure 20–Font Characters
  25662.  
  25663. æKY checkMark
  25664. æFp Fonts.p
  25665. æT CONST
  25666. æD checkMark = 18;
  25667. æC 
  25668.  
  25669. æKY diamondMark
  25670. æFp Fonts.p
  25671. æT CONST
  25672. æD diamondMark = 19;
  25673. æC 
  25674.  
  25675. æKY appleMark
  25676. æFp Fonts.p
  25677. æT CONST
  25678. æD appleMark = 20;
  25679. æC 
  25680.  
  25681. æKY propFont
  25682. æFp Fonts.p
  25683. æT CONST
  25684. æD propFont = 36864;
  25685. æC 
  25686.  
  25687. æKY prpFntH
  25688. æFp Fonts.p
  25689. æT CONST
  25690. æD prpFntH = 36865;
  25691. æC 
  25692.  
  25693. æKY prpFntW
  25694. æFp Fonts.p
  25695. æT CONST
  25696. æD prpFntW = 36866;
  25697. æC 
  25698.  
  25699. æKY prpFntHW
  25700. æFp Fonts.p
  25701. æT CONST
  25702. æD prpFntHW = 36867;
  25703. æC 
  25704.  
  25705. æKY fixedFont
  25706. æFp Fonts.p
  25707. æT CONST
  25708. æD fixedFont = 45056;
  25709. æC 
  25710.  
  25711. æKY fxdFntH
  25712. æFp Fonts.p
  25713. æT CONST
  25714. æD fxdFntH = 45057;
  25715. æC 
  25716.  
  25717. æKY fxdFntW
  25718. æFp Fonts.p
  25719. æT CONST
  25720. æD fxdFntW = 45058;
  25721. æC 
  25722.  
  25723. æKY fxdFntHW
  25724. æFp Fonts.p
  25725. æT CONST
  25726. æD fxdFntHW = 45059;
  25727. æC 
  25728.  
  25729. æKY fontWid
  25730. æFp Fonts.p
  25731. æT CONST
  25732. æD fontWid = 44208;
  25733. æC 
  25734.  
  25735. æKY FMInput
  25736. æFp Fonts.p
  25737. æT RECORD
  25738. æD FMInput = PACKED RECORD
  25739.     family: INTEGER;
  25740.     size: INTEGER;
  25741.     face: Style;
  25742.     needBits: BOOLEAN;
  25743.     device: INTEGER;
  25744.     numer: Point;
  25745.     denom: Point;
  25746.     END;
  25747. æC 
  25748. _______________________________________________________________________________
  25749.  
  25750. »COMMUNICATION BETWEEN QUICKDRAW AND THE FONT MANAGER
  25751. _______________________________________________________________________________
  25752.  
  25753. This section describes the data structures that allow QuickDraw and the Font Manager
  25754. to exchange information. It also discusses the communication that may occur between
  25755. the Font Manager and the driver of the device on which the characters are being drawn
  25756. or printed. You can skip this section if you want to change fonts, character style,
  25757. and font sizes by calling QuickDraw and aren’t interested in the lower-level data
  25758. structures and routines of the Font Manager. To understand this section fully, you’ll
  25759. have to be familiar with device drivers and the Device Manager.
  25760.  
  25761. Whenever you call a QuickDraw routine that does anything with text, QuickDraw requests
  25762. information from the Font Manager about the characters. The Font Manager performs any
  25763. necessary calculations and returns the requested information to QuickDraw. As illustrated
  25764. in Figure 21, this information exchange occurs via two data structures, a font input
  25765. record (type FMInput) and a font output record (type FMOutput).
  25766.  
  25767. First, QuickDraw passes the Font Manager a font input record:
  25768.  
  25769. TYPE FMInput = PACKED RECORD
  25770.                  family:    INTEGER;  {font number}
  25771.                  size:      INTEGER;  {font size}
  25772.                  face:      Style;    {character style}
  25773.                  needBits:  BOOLEAN;  {TRUE if drawing}
  25774.                  device:    INTEGER;  {device-specific information}
  25775.                  numer:     Point;    {numerators of scaling factors}
  25776.                  denom:     Point     {denominators of scaling factors}
  25777.                END;
  25778.  
  25779. The first three fields contain the font number, size, and character style that QuickDraw
  25780. wants to use.
  25781.  
  25782. The needBits field indicates whether the characters actually will be drawn or not. If
  25783. the characters are being drawn, all of the information describing the font, including
  25784. the bit image comprising the characters, will be read into memory. If the characters
  25785. aren’t being drawn and there’s a resource consisting of only the character widths and
  25786. general font information, that resource will be read instead.
  25787.  
  25788. The high-order byte of the device field contains a device driver reference number.
  25789. From the driver reference number, the Font Manager can determine the optimum stylistic
  25790. variations on the font to produce the highest-quality printing or drawing available
  25791. on a device (as explained below). The low-order byte of the device field is ignored
  25792. by the Font Manager but may contain information used by the device driver.
  25793.  
  25794. •••Refer to Figure 21.•••
  25795.  
  25796. Figure 21–Communication About Fonts
  25797.  
  25798. The numer and denom fields contain the scaling factors to be used; numer.v divided by
  25799. denom.v gives the vertical scaling, and numer.h divided by denom.h gives the horizontal
  25800. scaling.
  25801.  
  25802. The Font Manager takes the font input record and asks the Resource Manager for the
  25803. font. If the requested size isn’t available, the Font Manager scales another size to
  25804. match (as described under “Font Scaling”).
  25805.  
  25806. Then the Font Manager gets the font characterization table via the device field. If
  25807. the high-order byte of the device field is 0, the Font Manager gets the screen’s font
  25808. characterization table (which is stored in the Font Manager). If the high-order byte
  25809. of the device field is nonzero, the Font Manager calls the status routine of the
  25810. device driver having that reference number, and the status routine returns a font
  25811. characterization table. The status routine may use the value of the low-order byte of
  25812. the device field to determine the font characterization table it should return.
  25813.  
  25814. Note:  If you want to make your own calls to the device driver’s Status
  25815.        function, the reference number must be the driver reference number
  25816.        from the font input record’s device field, csCode must be 8, csParam
  25817.        must be a pointer to where the device driver should put the font
  25818.        characterization table, and csParam+4 must be an integer containing
  25819.        the value of the font input record’s device field.
  25820.  
  25821. Figure 22 shows the structure of a font characterization table and, on the right, the
  25822. values it contains for the Macintosh screen.
  25823.  
  25824. •••Refer to Figure 22.•••
  25825.  
  25826. Figure 22–Font Characterization Table
  25827.  
  25828. The first two words of the font characterization table contain the approximate number
  25829. of dots per inch on the device. These values are only used for scaling between devices;
  25830. they don’t necessarily correspond to a device’s actual resolution.
  25831.  
  25832. The remainder of the table consists of three-byte triplets providing information
  25833. about the different stylistic variations. For all but the triplet defining the underline
  25834. characteristics:
  25835.  
  25836.   •  The first byte in the triplet indicates which byte beyond the bold
  25837.      field of the font output record (see below) is affected by the triplet.
  25838.   •  The second byte contains the amount to be stored in the affected field.
  25839.   •  The third byte indicates the amount by which the extra field of the
  25840.      font output record is to be incremented (starting from 0).
  25841.  
  25842. The triplet defining the underline characteristics indicates the amount by which the
  25843. font output record’s ulOffset, ulShadow, and ulThick fields
  25844. (respectively) should be incremented.
  25845.  
  25846. æKY FMOutput
  25847. FMOutPtr
  25848. æFp Fonts.p
  25849. æT RECORD
  25850. æD FMOutPtr = ^FMOutput;
  25851. FMOutput = PACKED RECORD
  25852.     errNum: INTEGER;
  25853.     fontHandle: Handle;
  25854.     bold: Byte;
  25855.     italic: Byte;
  25856.     ulOffset: Byte;
  25857.     ulShadow: Byte;
  25858.     ulThick: Byte;
  25859.     shadow: Byte;
  25860.     extra: SignedByte;
  25861.     ascent: Byte;
  25862.     descent: Byte;
  25863.     widMax: Byte;
  25864.     leading: SignedByte;
  25865.     unused: Byte;
  25866.     numer: Point;
  25867.     denom: Point;
  25868.     END;
  25869. æC 
  25870. Based on the information in the font characterization table, the Font Manager determines
  25871. the optimum ascent, descent, and leading, so that the highest-quality printing or
  25872. drawing available will be produced. It then stores this information in a font output
  25873. record:
  25874.  
  25875. TYPE FMOutput = PACKED RECORD
  25876.                   errNum:      INTEGER;     {not used}
  25877.                   fontHandle:  Handle;      {handle to font record}
  25878.                   bold:        Byte;        {bold factor}
  25879.                   italic:      Byte;        {italic factor}
  25880.                   ulOffset:    Byte;        {underline offset}
  25881.                   ulShadow:    Byte;        {underline shadow}
  25882.                   ulThick:     Byte;        {underline thickness}
  25883.                   shadow:      Byte;        {shadow factor}
  25884.                   extra:       SignedByte;  {width of style}
  25885.                   ascent:      Byte;        {ascent}
  25886.                   descent:     Byte;        {descent}
  25887.                   widMax:      Byte;        {maximum character width}
  25888.                   leading:     SignedByte;  {leading}
  25889.                   unused:      Byte;        {not used}
  25890.                   numer:       Point;       {numerators of scaling factors}
  25891.                   denom:       Point        {denominators of scaling factors}
  25892.                 END;
  25893.  
  25894. ErrNum is reserved for future use, and is set to 0. FontHandle is a handle to the
  25895. font record of the font, as described in the next section. Bold, italic, ulOffset,
  25896. ulShadow, ulThick, and shadow are all fields that modify the way stylistic variations
  25897. are done; their values are taken from the font characterization table, and are used
  25898. by QuickDraw. (You’ll need to experiment with these values if you want to determine
  25899. exactly how they’re used.) Extra indicates the number of pixels that each character
  25900. has been widened by stylistic variation. For example, using the screen values shown
  25901. in Figure 22, the extra field for bold shadowed characters would be 3. Ascent, descent,
  25902. widMax, and leading are the same as the fields of the FontInfo record returned by the
  25903. QuickDraw procedure GetFontInfo. Numer and denom contain the scaling factors.
  25904.  
  25905. Just before returning this record to QuickDraw, the Font Manager calls the device
  25906. driver’s control routine to allow the driver to make any final modifications to the
  25907. record. Finally, the font information is returned to QuickDraw via a pointer to the
  25908. record, defined as follows:
  25909.  
  25910. TYPE FMOutPtr = ^FMOutput;
  25911.  
  25912. Note:  If you want to make your own calls to the device driver’s Control
  25913.        function, the reference number must be the driver reference number
  25914.        from the font input record’s device field, csCode must be 8, csParam
  25915.        must be a pointer to the font output record, and csParam+4 must be
  25916.        the value of the font input record’s device field.
  25917.  
  25918. æKY FontRec
  25919. æFp Fonts.p
  25920. æT RECORD
  25921. æD FontRec = RECORD
  25922.     fontType: INTEGER; {font type}
  25923.     firstChar: INTEGER; {ASCII code of first character}
  25924.     lastChar: INTEGER; {ASCII code of last character}
  25925.     widMax: INTEGER; {maximum character width}
  25926.     kernMax: INTEGER; {negative of maximum character kern}
  25927.     nDescent: INTEGER; {negative of descent}
  25928.     fRectWidth: INTEGER; {width of font rectangle}
  25929.     fRectHeight: INTEGER; {height of font rectangle}
  25930.     owTLoc: INTEGER; {offset to offset/width table}
  25931.     ascent: INTEGER; {ascent}
  25932.     descent: INTEGER; {descent}
  25933.     leading: INTEGER; {leading}
  25934.     rowWords: INTEGER; {row width of bit image / 2 }
  25935.     END;
  25936. æC 
  25937. »Font Records
  25938.  
  25939. The information describing a font is contained in a data structure called a font
  25940. record, which contains the following:
  25941.  
  25942.   •  the font type (fixed-width or proportional)
  25943.   •  the ASCII code of the first character and the last character in the font
  25944.   •  the maximum character width and maximum amount any character kerns
  25945.   •  the font height, ascent, descent, and leading
  25946.   •  the bit image of the font
  25947.   •  a location table, which is an array of words specifying the location
  25948.      of each character image within the bit image
  25949.   •  an offset/width table, which is an array of words specifying the
  25950.      character offset and character width for each character in the font
  25951.  
  25952. For every character, the location table contains a word that specifies the bit offset
  25953. to the location of that character’s image in the bit image. The entry for a character
  25954. missing from the font contains the same value as the entry for the next character.
  25955. The last word of the table contains the offset to one bit beyond the end of the bit
  25956. image (that is, beyond the character image for the missing symbol). The image width
  25957. of each character is determined from the location table by subtracting the bit offset
  25958. to that character from the bit offset to the next character in the table.
  25959.  
  25960. There’s also one word in the offset/width table for every character:  The high-order
  25961. byte specifies the character offset and the low order byte specifies the character
  25962. width. Missing characters are flagged in this table by a word value of –1. The last
  25963. word is also –1, indicating the end of the table.
  25964.  
  25965. Note:  The 64K ROM version of the Resource Manager limits the total space
  25966.        occupied by the bit image, location table, offset/width table, and
  25967.        character-width and image-height tables to 32K bytes. For this reason,
  25968.        the practical limit on the font size of a full font is about 40 points.
  25969.  
  25970. Figure 9 illustrates a sample location table and offset/width table corresponding to
  25971. the bit image in Figure 8 above.
  25972.  
  25973. A font record is referred to by a handle that you can get by calling the FMSwapFont
  25974. function or the Resource Manager function GetResource. The data type for a font
  25975. record is as follows:
  25976.  
  25977. TYPE FontRec = RECORD
  25978.                  fontType:     INTEGER;    {font type}
  25979.                  firstChar:    INTEGER;    {ASCII code of first character}
  25980.                  lastChar:     INTEGER;    {ASCII code of last character}
  25981.                  widMax:       INTEGER;    {maximum character width}
  25982.                  kernMax:      INTEGER;    {negative of maximum character kern}
  25983.                  nDescent:     INTEGER;    {negative of descent}
  25984.                  fRectWidth:   INTEGER;    {width of font rectangle}
  25985.                  fRectHeight:  INTEGER;    {height of font rectangle}
  25986.                  owTLoc:       INTEGER;    {offset to offset/width table}
  25987.                  ascent:       INTEGER;    {ascent}
  25988.                  descent:      INTEGER;    {descent}
  25989.                  leading:      INTEGER;    {leading}
  25990.                  rowWords:     INTEGER;    {row width of bit image / 2}
  25991.                { bitImage:     ARRAY[1..rowWords,1..fRectHeight] OF INTEGER; }
  25992.                                            {bit image}
  25993.                { locTable:     ARRAY[firstChar..lastChar+2] OF INTEGER; }
  25994.                                            {location table}
  25995.                { owTable:      ARRAY[firstChar..lastChar+2] OF INTEGER; }
  25996.                                            {offset/width table}
  25997.                END;
  25998.  
  25999. Note:  The variable-length arrays appear as comments because they’re
  26000.        not valid Pascal syntax; they’re used only as conceptual aids.
  26001.  
  26002. •••Refer to Figure 9.•••
  26003.  
  26004. Figure 9–Sample Location Table and Offset/Width Table
  26005.  
  26006. The fontType field must contain one of the following predefined constants:
  26007.  
  26008. CONST  propFont   = $9000;    {proportional font}
  26009.        fixedFont  = $B000;    {fixed-width font}
  26010.  
  26011. The values in the widMax, kernMax, nDescent, fRectWidth, fRectHeight, ascent, descent,
  26012. and leading fields all specify a number of pixels.
  26013.  
  26014. KernMax indicates the largest number of pixels any character kerns, that is, the
  26015. distance from the character origin to the left edge of the font rectangle. It should
  26016. always be 0 or negative, since the kerned pixels are to the left of the character
  26017. origin. NDescent is the negative of the descent (the distance from the character
  26018. origin to the bottom of the font rectangle).
  26019.  
  26020. The owTLoc field contains a word offset from itself to the offset/width table; it’s
  26021. equivalent to
  26022.  
  26023.   4 + (rowWords * fRectHeight) + (lastChar–firstChar+3) + 1
  26024.  
  26025. Warning:  Remember, the offset and row width in a font record are
  26026.           given in words, not bytes.
  26027.  
  26028. Assembly-language note:  The global variable ROMFont0 contains a handle
  26029.                          to the font record for the system font.
  26030.  
  26031. Every size of a font is stored as a separate resource.  The resource type for a font
  26032. is 'FONT'.  The resource data for a font is simply a font record:
  26033.  
  26034.   Number of bytes    Contents
  26035.  
  26036.       2 bytes        FontType field of font record
  26037.       2 bytes        FirstChar field of font record
  26038.       2 bytes        LastChar field of font record
  26039.       2 bytes        WidMax field of font record
  26040.       2 bytes        KernMax field of font record
  26041.       2 bytes        NDescent field of font record
  26042.       2 bytes        FRectWidth field of font record
  26043.       2 bytes        FRectHeight field of font record
  26044.       2 bytes        OWTLoc field of font record
  26045.       2 bytes        Ascent field of font record
  26046.       2 bytes        Descent field of font record
  26047.       2 bytes        Leading field of font record
  26048.       2 bytes        RowWords field of font record
  26049.       n bytes        Bit image of font
  26050.                          n = 2 * rowWords * fRectHeight
  26051.       m bytes        Location table of font
  26052.                          m = 2 * (lastChar–firstChar+3)
  26053.       m bytes        Offset/width table of font
  26054.                          m = 2 * (lastChar–firstChar+3)
  26055.  
  26056. As shown in Figure 10, the resource ID of a font has the following format:  Bits 0-6
  26057. are the font size, bits 7-14 are the font number, and bit 15 is 0. Thus the resource
  26058. ID corresponding to a given font number and size is
  26059.  
  26060.   (128 * font number) + font size
  26061.  
  26062. •••Refer to Technical Note #245:•••
  26063.  
  26064. Since 0 is not a valid font size, the resource ID having 0 in the size field is used
  26065. to provide only the name of the font:  The name of the resource is the font name. For
  26066. example, for a font named Griffin and numbered 200, the resource naming the font
  26067. would have a resource ID of 25600 and the resource name
  26068. 'Griffin'. Size 10 of that font would be stored in a resource numbered 25610.
  26069.  
  26070. •••Refer to Figure 10.•••
  26071.  
  26072. Figure 10–Resource ID for a Font
  26073.  
  26074. The resource type 'FRSV' is reserved by the Font Manager; it identifies fonts used by
  26075. the system. Fonts whose resource IDs are contained in a 'FRSV' resource 1 will not be
  26076. removed from the system resource file by the Font/DA Mover. The format of a 'FRSV'
  26077. resource is as follows:
  26078.  
  26079.   Number of bytes    Contents
  26080.  
  26081.       2 bytes        Number of font resource IDs
  26082.       n * 2 bytes    n font resource IDs
  26083.  
  26084. æKY FMetricRec
  26085. æFp Fonts.p
  26086. æT RECORD
  26087. æD FMetricRec = RECORD
  26088.     ascent: Fixed; {base line to top}
  26089.     descent: Fixed; {base line to bottom}
  26090.     leading: Fixed; {leading between lines}
  26091.     widMax: Fixed; {maximum character width}
  26092.     wTabHandle: Handle; {handle to font width table}
  26093.     END;
  26094. æC 
  26095.  
  26096. æKY WidEntry
  26097. æFp Fonts.p
  26098. æT RECORD
  26099. æD WidEntry = RECORD
  26100.     widStyle: INTEGER; {style entry applies to}
  26101.     END;
  26102. æC 
  26103.  
  26104. æKY WidTable
  26105. æFp Fonts.p
  26106. æT RECORD
  26107. æD WidTable = RECORD
  26108.     numWidths: INTEGER; {number of entries - 1}
  26109.     END;
  26110. æC 
  26111.  
  26112. æKY AsscEntry
  26113. æFp Fonts.p
  26114. æT RECORD
  26115. æD AsscEntry = RECORD
  26116.     fontSize: INTEGER;
  26117.     fontStyle: INTEGER;
  26118.     fontID: INTEGER; {font resource ID}
  26119.     END;
  26120. æC 
  26121.  
  26122. æKY FontAssoc
  26123. æFp Fonts.p
  26124. æT RECORD
  26125. æD FontAssoc = RECORD
  26126.     numAssoc: INTEGER; {number of entries - 1}
  26127.     END;
  26128. æC 
  26129.  
  26130. æKY StyleTable
  26131. æFp Fonts.p
  26132. æT RECORD
  26133. æD StyleTable = RECORD
  26134.     fontClass: INTEGER;
  26135.     offset: LONGINT;
  26136.     reserved: LONGINT;
  26137.     indexes: ARRAY [0..47] OF SignedByte;
  26138.     END;
  26139. æC 
  26140.  
  26141. æKY NameTable
  26142. æFp Fonts.p
  26143. æT RECORD
  26144. æD NameTable = RECORD
  26145.     stringCount: INTEGER;
  26146.     baseFontName: Str255;
  26147.     END;
  26148. æC 
  26149.  
  26150. æKY KernPair
  26151. æFp Fonts.p
  26152. æT RECORD
  26153. æD KernPair = RECORD
  26154.     kernFirst: CHAR; {1st character of kerned pair}
  26155.     kernSecond: CHAR; {2nd character of kerned pair}
  26156.     kernWidth: INTEGER; {kerning in 1pt fixed format}
  26157.     END;
  26158. æC 
  26159.  
  26160. æKY KernEntry
  26161. æFp Fonts.p
  26162. æT RECORD
  26163. æD KernEntry = RECORD
  26164.     kernLength: INTEGER; {length of this entry}
  26165.     kernStyle: INTEGER; {style the entry applies to}
  26166.     END;
  26167. æC 
  26168.  
  26169. æKY KernTable
  26170. æFp Fonts.p
  26171. æT RECORD
  26172. æD KernTable = RECORD
  26173.     numKerns: INTEGER; {number of kerning entries}
  26174.     END;
  26175. æC 
  26176.  
  26177. æKY WidthTable
  26178. æFp Fonts.p
  26179. æT RECORD
  26180. æD WidthTable = PACKED RECORD
  26181.     tabData: ARRAY [1..256] OF Fixed; {character widths}
  26182.     tabFont: Handle; {font record used to build table}
  26183.     sExtra: LONGINT; {space extra used for table}
  26184.     style: LONGINT; {extra due to style}
  26185.     fID: INTEGER; {font family ID}
  26186.     fSize: INTEGER; {font size request}
  26187.     face: INTEGER; {style (face) request}
  26188.     device: INTEGER; {device requested}
  26189.     inNumer: Point; {scale factors requested}
  26190.     inDenom: Point; {scale factors requested}
  26191.     aFID: INTEGER; {actual font family ID for table}
  26192.     fHand: Handle; {family record used to build up table}
  26193.     usedFam: BOOLEAN; {used fixed point family widths}
  26194.     aFace: Byte; {actual face produced}
  26195.     vOutput: INTEGER; {vertical scale output value}
  26196.     hOutput: INTEGER; {horizontal scale output value}
  26197.     vFactor: INTEGER; {vertical scale output value}
  26198.     hFactor: INTEGER; {horizontal scale output value}
  26199.     aSize: INTEGER; {actual size of actual font used}
  26200.     tabSize: INTEGER; {total size of table}
  26201.     END;
  26202. æC 
  26203. »Global Width Tables
  26204.  
  26205. Note:  The extensions to the Font Manager described in the following paragraphs
  26206.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26207.        this information refers to the 128K ROMs and System file version 3.2
  26208.        and later.
  26209.  
  26210. The Font Manager communicates fractional character widths to QuickDraw via a global
  26211. width table, a data structure allocated in the system heap. A handle to the global
  26212. width table is returned by the FontMetrics procedure. The format of the global width
  26213. table is follows:
  26214.  
  26215. TYPE WidthTable = RECORD
  26216.                     tabData:  ARRAY[1..256] OF Fixed; { character widths}
  26217.                     tabFont:  Handle;   {font record used to build table}
  26218.                     sExtra:   LONGINT;  {space extra used for table}
  26219.                     style:    LONGINT;  {extra due to style}
  26220.                     fID:      INTEGER;  {font family ID}
  26221.                     fSize:    INTEGER;  {font size request}
  26222.                     face:     INTEGER;  {style (face) request}
  26223.                     device:   INTEGER;  {device requested}
  26224.                     inNumer:  Point;    {numerators of scaling factors}
  26225.                     inDenom:  Point;    {denominators of scaling factors}
  26226.                     aFID:     INTEGER;  {actual font family ID for table}
  26227.                     fHand:    handle;   {family record used to build table}
  26228.                     usedFam:  BOOLEAN;  {used fixed-point family widths}
  26229.                     aFace:    Byte;     {actual face produced}
  26230.                     vOutput:  INTEGER;  {vertical factor for expanding }
  26231.                                         { characters}
  26232.                     hOutput:  INTEGER;  {horizontal factor for expanding }
  26233.                                         { characters}
  26234.                     vFactor:  INTEGER;  {not used}
  26235.                     hFactor:  INTEGER;  {horizontal factor for increasing }
  26236.                                         { character widths}
  26237.                     aSize:    INTEGER;  {actual size of actual font used}
  26238.                     tabSize:  INTEGER   {total size of table}
  26239.                   END;
  26240.  
  26241. TabData is an array containing a character width for each of the 255 possible characters
  26242. in a font, plus one long word for the font’s missing symbol. The widths are stored in
  26243. the standard 32-bit fixed-point format. If a character is missing, its entry contains
  26244. the width of the missing symbol. (For efficiency, the Font Manager will store up to
  26245. 12 recently used global width tables.) InNumer and inDenom contain the vertical and
  26246. horizontal scaling factors copied from the font input record.
  26247.  
  26248. Scaling is effected in two ways:  by expanding characters of the chosen font and by
  26249. artificially increasing the widths of the chosen font in the width table. HOutput and
  26250. vOutput give the factors by which characters are to be expanded horizontally and
  26251. vertically. HFactor is the factor by which the widths of the chosen font, after
  26252. stylistic variations, have been increased. (VFactor is not used.) Thus, multiplying
  26253. hOutput and vOutput by hFactor and vFactor gives the true font scaling; the product
  26254. of hOutput and an entry in the width table is that character’s true scaled width.
  26255. HOutput,vOutput, hFactor, and vFactor are all 16-bit fixed-point numbers, with an
  26256. integer part in the high-order byte and a fractional part in the low-order byte.
  26257.  
  26258. If font scaling has been enabled, hFactor and vFactor both have a value of 1. In any
  26259. case, hOutput, vOutput, hFactor, and vFactor are adjusted so that the values of
  26260. hFactor and vFactor lie between 1 and 2, including 1.
  26261.  
  26262. Assembly-language note:  A handle to the global width table is contained
  26263.                          in the global variable WidthTabHandle. A pointer
  26264.                          to the table is contained in the global variable
  26265.                          WidthPtr; it’s reliable immediately after a call
  26266.                          to FMSwapFont but, like all pointers, may become
  26267.                          invalid after a call to the Memory Manager.
  26268.  
  26269.                          The global variable WidthListHand is a handle to a
  26270.                          list of handles to up to 12 recently-used width
  26271.                          tables. You can scan this list, looking for width
  26272.                          tables that match the family number, size, and style
  26273.                          of the font you wish to measure. If you reach a width
  26274.                          handle that’s equal to –1, that width table is
  26275.                          invalid, and you must make an FMSwapFont call to
  26276.                          get a valid one. When you reach a handle that’s zero,
  26277.                          you’ve reached the end of the list.
  26278.  
  26279.                          You should not use the global width table when
  26280.                          special international interface software is being
  26281.                          used to accommodate non-Roman alphabets. You can
  26282.                          recognize such software by looking at the global
  26283.                          variable IntlSpec; if it’s greater than 0, special
  26284.                          international software is installed. If your
  26285.                          application uses non-Roman alphabets, write to
  26286.  
  26287.                              Developer Technical Support
  26288.                              Apple Computer, Inc.
  26289.                              20525 Mariani Avenue, M/S 75-3T
  26290.                              Cupertino, CA 95014
  26291.  
  26292.                          for the latest version of the International Utilities
  26293.                          Package, which will be extended to handle non-Roman
  26294.                          alphabets.
  26295.  
  26296. æKY FamRec
  26297. æFp Fonts.p
  26298. æT RECORD
  26299. æD FamRec = RECORD
  26300.     ffFlags: INTEGER; {flags for family}
  26301.     ffFamID: INTEGER; {family ID number}
  26302.     ffFirstChar: INTEGER; {ASCII code of 1st character}
  26303.     ffLastChar: INTEGER; {ASCII code of last character}
  26304.     ffAscent: INTEGER; {maximum ascent for 1pt font}
  26305.     ffDescent: INTEGER; {maximum descent for 1pt font}
  26306.     ffLeading: INTEGER; {maximum leading for 1pt font}
  26307.     ffWidMax: INTEGER; {maximum widMax for 1pt font}
  26308.     ffWTabOff: LONGINT; {offset to width table}
  26309.     ffKernOff: LONGINT; {offset to kerning table}
  26310.     ffStylOff: LONGINT; {offset to style mapping table}
  26311.     ffProperty: ARRAY [1..9] OF INTEGER; {style property info}
  26312.     ffIntl: ARRAY [1..2] OF INTEGER; {for international use}
  26313.     ffVersion: INTEGER; {version number}
  26314.     END;
  26315. æC 
  26316. »Family Records
  26317.  
  26318. Note:  The extensions to the Font Manager described in the following paragraphs
  26319.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26320.        this information refers to the 128K ROMs and System file version 3.2
  26321.        and later.
  26322.  
  26323. Assembly-language note:  The global variable LastFOND is a handle to the last
  26324.                          family record used. You can read the contents of the
  26325.                          family record by using this handle. You should not
  26326.                          alter the contents of this record.
  26327.  
  26328. The data type for a family record is as follows:
  26329.  
  26330. TYPE FamRec = RECORD
  26331.                 ffFlags:      INTEGER;    {flags for family}
  26332.                 ffFamID:      INTEGER;    {family ID number}
  26333.                 ffFirstChar:  INTEGER;    {ASCII code of the first character}
  26334.                 ffLastChar:   INTEGER;    {ASCII code of the last character}
  26335.                 ffAscent:     INTEGER;    {maximum ascent for 1-pt.font}
  26336.                 ffDescent:    INTEGER;    {maximum descent for 1-pt.font}
  26337.                 ffLeading:    INTEGER;    {maximum leading for 1-pt.font}
  26338.                 ffWidMax:     INTEGER;    {maximum width for 1-pt.font}
  26339.                 ffWTabOff:    LONGINT;    {offset to width table}
  26340.                 ffKernOff:    LONGINT;    {offset to kerning table}
  26341.                 ffStylOff:    LONGINT;    {offset to style-mapping table}
  26342.                 ffProperty:   ARRAY[1..9] OF INTEGER; {style property info}
  26343.                 ffIntl:       ARRAY[1..2] OF INTEGER; {reserved}
  26344.                 ffVersion:    INTEGER;    {version number}
  26345.              {  ffAssoc:      FontAssoc;} {font association table}
  26346.              {  ffWidthTab:   WidTable;}  {width table}
  26347.              {  ffStyTab:     StyleTable;}{style-mapping table}
  26348.              {  ffKernTab:    KernTable;} {kerning table}
  26349.               END;
  26350.  
  26351. Note:  The variable-length arrays appear as comments because they’re not
  26352.        valid Pascal syntax; they’re used only as conceptual aids.  This
  26353.        version of the FamRec is accurate for Volume IV; the extensions to
  26354.        the FamRec made in Volume V are not included here.
  26355.  
  26356. The ffFlags field defines general characteristics of the font family, as follows:
  26357.  
  26358.   Bit    Meaning
  26359.   0      Set if there’s an image-height table
  26360.   1      Set if there’s a character-width table
  26361.   2–11   Reserved (should be zero)
  26362.   12     Set to ignore FractEnable when deciding whether to use
  26363.          fixed-point values for stylistic variations (see bit 13),
  26364.          clear to treat FractEnable as usual
  26365.   13     Set to use integer extra width for stylistic variations,
  26366.          clear to compute fixed-point extra width from the family
  26367.          style-mapping table when FractEnable is TRUE
  26368.   14     Set if family fractional-width table is not used, clear
  26369.          if table is used
  26370.   15     Set for fixed-width font, clear for proportional font
  26371.  
  26372. The values in the ffAscent, ffDescent, ffLeading, and ffWidMax describe the maximum
  26373. dimensions of the family as they would be for a hypothetical one-point font to be
  26374. scaled up. They use a special 16-bit fixed-point format with an integer part in the
  26375. high-order 4 bits and a fractional part in the low-order 12 bits. The FontMetrics
  26376. procedure calculates the true values by multiplying this number by the actual point
  26377. size.
  26378.  
  26379. The ffWTabOff, ffKernOff, and ffStylOff fields are offsets from the top of the record
  26380. to the start of the width table, kerning table, and style-mapping table, respectively;
  26381. if any of these fields is zero, the corresponding table does not exist.
  26382.  
  26383. The ffProperty field is the family style-property table, shown in Figure 11.
  26384.  
  26385. •••Refer to Figure 11.•••
  26386.  
  26387. Figure 11–Family Style-Property Table
  26388.  
  26389. Each entry is a 16-bit fixed-point number with a signed integer part in the high-order
  26390. 4 bits and a fractional part in the low-order 12 bits. These numbers are used to
  26391. calculate the amount of extra width for special stylistic variations; each of these
  26392. values is multiplied by the point size of the font actually being used. If the font
  26393. already exists for a given style, the value in its field is ignored.
  26394.  
  26395. The ffAssoc field contains the font association table. This table, shown in Figure
  26396. 12, is used to match a given font size and style combination with the resource ID of
  26397. an actual font.
  26398.  
  26399. •••Refer to Figure 12.•••
  26400.  
  26401. Figure 12–Font Association Table
  26402.  
  26403. Note:  In order to reduce search time, the Font Manager requires that
  26404.        the entries be sorted according to the fontSize field, with the
  26405.        smallest sizes first. If multiple fonts from the same family, the
  26406.        plain (roman) fonts come first. The Font Manager is optimized to
  26407.        look first for 'NFNT' resources, then 'FONT' resources.
  26408.  
  26409. Each entry in the font association table has the format shown in Figure 13.
  26410.  
  26411. •••Refer to Figure 13.•••
  26412.  
  26413. Figure 13–Font Association Table Entry
  26414.  
  26415. The font association table is followed by the family character-width table. As shown
  26416. in Figure 14, this table is actually a number of width tables (since a font family
  26417. may include numerous styles).
  26418.  
  26419. •••Refer to Figure 14.•••
  26420.  
  26421. Figure 14–Family Character-Width Table
  26422.  
  26423. Each character-width table is preceded by a style code; the low-order byte of this
  26424. word specifies stylistic variations (see Figure 15). The widths in each table are for
  26425. a hypothetical one-point font; the actual values for the characters are calculated by
  26426. multiplying these widths by the font size. The widths in this table are stored in a
  26427. 16-bit fixed-point format with an unsigned integer part in the high-order 4 bits and
  26428. a fractional part in the low-order 12 bits.
  26429.  
  26430. •••Refer to Figure 15.•••
  26431.  
  26432. Figure 15–Style Codes
  26433.  
  26434. The style-mapping table and its associated tables are used by the LaserWriter driver
  26435. and are described in the Apple LaserWriter Reference.
  26436.  
  26437. The kerning table, like the family character-width table, is actually a number of
  26438. kerning tables (see Figure 16).
  26439.  
  26440. •••Refer to Figure 16.•••
  26441.  
  26442. Figure 16–Kerning Table
  26443.  
  26444. Each kerning table is preceded by a style code; stored in the low-order byte of the
  26445. word, this style information has the same format shown in Figure 15 above. The number
  26446. of entries in the table follows the style word (see Figure 17).
  26447.  
  26448. •••Refer to Figure 17.•••
  26449.  
  26450. Figure 17–Structure of a Kerning Table
  26451.  
  26452. The entries in each kerning table (shown in Figure 18) consist of a pair of characters
  26453. followed by a kerning offset for a hypothetical one-point font. This value, represented
  26454. by an integer part in the high-order 4 bits and a fractional part in the low-order 12
  26455. bits, is multiplied by the size of the font to obtain the actual offset.
  26456.  
  26457. •••Refer to Figure 18.•••
  26458.  
  26459. Figure 18–Kerning Table Entry
  26460.  
  26461. Note:  The extensions to the Font Manager described in the following paragraphs
  26462.        were originally documented in Inside Macintosh, Volume V.  As such,
  26463.        this information refers to the Macintosh SE and Macintosh II ROMs and
  26464.        System file version 4.1 and later.
  26465.  
  26466. For Macintosh II only, bits 8 and 9 of the font style word within each font association
  26467. table specify the font depth; they must contain the same value as bits 2 and 3 of the
  26468. fontType field of the font record.  All other undefined bits remain 0.
  26469.  
  26470. A font family is stored as a resource of type 'FOND', and with the Macintosh II, it’s
  26471. format has been extended.  The new format is the following (with extension fields
  26472. indicated by asterisks):
  26473.  
  26474.   Number of bytes    Contents
  26475.  
  26476.       2 bytes        FONDFlags field of family record
  26477.       2 bytes        FONDFamID field of family record
  26478.       2 bytes        FONDFirst field of family record
  26479.       2 bytes        FONDLast field of family record
  26480.       2 bytes        FONDAscent field of family record
  26481.       2 bytes        FONDDescent field of family record
  26482.       2 bytes        FONDLeading field of family record
  26483.       2 bytes        FONDWidMax field of family record
  26484.       4 bytes        FONDWTabOff of family record
  26485.       4 bytes        FONDKernOff of family record
  26486.       4 bytes        FONDStylOff of family record
  26487.       24 bytes       FONDProperty field of family record
  26488.       4 bytes        FONDIntl field of family record
  26489.       2 bytes        *Version number ($02)
  26490.       m bytes        FONDAssoc field of family record (variable length)
  26491.       2 bytes        *Number of offsets minus 1
  26492.       4 bytes        *Offset to bounding box table
  26493.       n bytes        *Bounding box table
  26494.       p bytes        FONDWidTable field of family record (variable length)
  26495.       q bytes        FONDStylTab field of family record (variable length)
  26496.       r bytes        FONDKerntab field of family record (variable length)
  26497.  
  26498. The bounding box table has an entry for each style available in the family.  The
  26499. table as a whole has this form:
  26500.  
  26501.   Number of bytes    Contents
  26502.  
  26503.       2 bytes        Number of entries minus 1
  26504.       10 bytes       First entry
  26505.       10 bytes       Second entry . . .
  26506.  
  26507. Each bounding box entry has this form, giving the bounding box position with respect
  26508. to the origin of the characters:
  26509.  
  26510.   Number of bytes    Contents
  26511.  
  26512.       2 bytes        Style word
  26513.       2 bytes        Lower left x coordinate
  26514.       2 bytes        Lower left y coordinate
  26515.       2 bytes        Upper right x coordinate
  26516.       2 bytes        Upper right y coordinate
  26517.  
  26518. Note:  The extensions to the Font Manager described in the following paragraphs
  26519.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26520.        this information refers to the 128K ROMs and System file version 3.2
  26521.        and later.
  26522.  
  26523. æKY InitFonts
  26524. æFp Fonts.p
  26525. æT PROCEDURE
  26526. æTN A8FE
  26527. æD PROCEDURE InitFonts;
  26528.     INLINE $A8FE;
  26529. æDT InitFonts(paramList);
  26530. æMM
  26531. æRT 72
  26532. æRI I-222, P-31, 95, 101, 107, 112, 118, 174
  26533. æC  
  26534. InitFonts initializes the Font Manager. If the system font isn’t already in memory,
  26535. InitFonts reads it into memory. Call this procedure once before all other Font Manager
  26536. routines or any Toolbox routine that will call the Font Manager.
  26537.  
  26538. æKY GetFontName
  26539. æFp Fonts.p
  26540. æT PROCEDURE
  26541. æTN A8FF
  26542. æD PROCEDURE GetFontName(familyID: INTEGER;VAR theName: Str255);
  26543.     INLINE $A8FF;
  26544. æDT GetFontName(familyID,theName);
  26545. æMM
  26546. æRT 191
  26547. æRI I-223
  26548. æC  
  26549. Warning:  Before returning, the routines in this section issue the Resource
  26550.           Manager call SetResLoad(TRUE). If your program previously called
  26551.           SetResLoad(FALSE) and you still want that to be in effect after
  26552.           calling one of these Font Manager routines, you’ll have to call
  26553.           SetResLoad(FALSE) again.
  26554.  
  26555. PROCEDURE GetFontName (fontNum:  INTEGER; VAR theName:  Str255);
  26556.  
  26557. Assembly-language note:  The macro you invoke to call GetFontName from
  26558.                          assembly language is named _GetFName.
  26559.  
  26560. GetFontName returns in theName the name of the font having the font number fontNum.
  26561. If there’s no such font, GetFontName returns the empty string.
  26562.  
  26563. æKY GetFNum
  26564. æFp Fonts.p
  26565. æT PROCEDURE
  26566. æTN A900
  26567. æD PROCEDURE GetFNum(theName: Str255;VAR familyID: INTEGER);
  26568.     INLINE $A900;
  26569. æDT GetFNum(theName,familyID);
  26570. æMM
  26571. æRT 191
  26572. æRI I-223
  26573. æC  
  26574. Warning:  Before returning, the routines in this section issue the Resource
  26575.           Manager call SetResLoad(TRUE). If your program previously called
  26576.           SetResLoad(FALSE) and you still want that to be in effect after
  26577.           calling one of these Font Manager routines, you’ll have to call
  26578.           SetResLoad(FALSE) again.
  26579.  
  26580.  
  26581. GetFNum returns in theNum the font number for the font having the given fontName. If
  26582. there’s no such font, GetFNum returns 0.
  26583.  
  26584. æKY RealFont
  26585. æFp Fonts.p
  26586. æT FUNCTION
  26587. æTN A902
  26588. æD FUNCTION RealFont(fontNum: INTEGER;size: INTEGER): BOOLEAN;
  26589.     INLINE $A902;
  26590. æDT myVariable := RealFont(fontNum,size);
  26591. æMM
  26592. æRI I-223
  26593. æC  
  26594. Warning:  Before returning, the routines in this section issue the Resource
  26595.           Manager call SetResLoad(TRUE). If your program previously called
  26596.           SetResLoad(FALSE) and you still want that to be in effect after
  26597.           calling one of these Font Manager routines, you’ll have to call
  26598.           SetResLoad(FALSE) again.
  26599.  
  26600. RealFont returns TRUE if the font having the font number fontNum is available in the
  26601. given size in a resource file, or FALSE if the font has to be scaled to that size.
  26602.  
  26603. Note:  RealFont will always return FALSE if you pass applFont in fontNum.
  26604.        To find out if the application font is available in a particular
  26605.        size, call GetFontName and then GetFNum to get the actual font
  26606.        number for the application font, and then call RealFont with that number.
  26607.  
  26608. æKY SetFontLock
  26609. æFp Fonts.p
  26610. æT PROCEDURE
  26611. æTN A903
  26612. æD PROCEDURE SetFontLock(lockFlag: BOOLEAN);
  26613.     INLINE $A903;
  26614. æDT SetFontLock(lockFlag);
  26615. æMM
  26616. æRI I-223
  26617. æC  
  26618. SetFontLock applies to the font in which text was most recently drawn. If lockFlag is
  26619. TRUE, SetFontLock makes the font unpurgeable (reading it into memory if it isn’t
  26620. already there). If lockFlag is FALSE, it releases the memory occupied by the font 
  26621. (by calling the Resource Manager procedure ReleaseResource).
  26622. Since fonts are normally purgeable, this procedure is useful for making a font temporarily
  26623. unpurgeable.
  26624.  
  26625. æKY FMSwapFont
  26626. æFp Fonts.p
  26627. æT FUNCTION
  26628. æTN A901
  26629. æD FUNCTION FMSwapFont(inRec: FMInput): FMOutPtr;
  26630.     INLINE $A901;
  26631. {     FMSwapFont returns a pointer to an FMOutput record containing the
  26632. size, style, and other information about an adapted version of the font
  26633. requested in the given FMInput record. (FMInput and FMOutput records
  26634. are explained in the following section.)  FMSwapFont is called by
  26635. QuickDraw every time a QuickDraw routine that does anything with text
  26636. is used. If you want to call FMSwapFont yourself, you must build an
  26637. FMInput record and then use the returned pointer to access the
  26638. resulting FMOutput record.
  26639.  }
  26640. æDT myVariable := FMSwapFont(inRec);
  26641. æMM
  26642. æRI I-223
  26643. æC 
  26644. The following low-level routine is called by QuickDraw and won’t normally be used by
  26645. an application directly, but it may be of interest to advanced programmers who want
  26646. to bypass the QuickDraw routines that deal with text.
  26647.  
  26648. FUNCTION FMSwapFont (inRec:  FMInput) :  FMOutPtr;
  26649.  
  26650. FMSwapFont returns a pointer to a font output record containing the size, style, and
  26651. other information about an adapted version of the font requested in the given font
  26652. input record. (Font input and output records are explained in the following section.)
  26653. FMSwapFont is called by QuickDraw every time a QuickDraw routine that does anything
  26654. with text is used. If you want to call FMSwapFont yourself, you must build a font
  26655. input record and then use the pointer returned by FMSwapFont to access the resulting
  26656. font output record.
  26657.  
  26658. æKY SetFScaleDisable
  26659. æFp Fonts.p
  26660. æT PROCEDURE
  26661. æTN A834
  26662. æD PROCEDURE SetFScaleDisable(fscaleDisable: BOOLEAN);
  26663.     INLINE $A834;
  26664. æDT SetFScaleDisable(fscaleDisable);
  26665. æRI IV-32
  26666. æC  
  26667. Note:  The extensions to the Font Manager described in the following paragraphs
  26668.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26669.        this information refers to the 128K ROMs and System file version 3.2
  26670.        and later.
  26671.  
  26672. SetFScaleDisable lets you disable or enable font scaling. If fScaleDisable is
  26673. TRUE, font scaling is disabled and the Font Manager returns an unscaled font with
  26674. more space around the characters; if it’s FALSE, the Font Manager scales fonts. To
  26675. ensure compatibility with existing applications, the Font Manager defaults to scaling
  26676. fonts.
  26677.  
  26678. Assembly-language note:  All programmers should use the SetFScaleDisable
  26679.                          procedure to disable and enable font scaling. In
  26680.                          particular, setting the global variable FScaleDisable
  26681.                          is insufficient.
  26682.  
  26683. æKY FontMetrics
  26684. æFp Fonts.p
  26685. æT PROCEDURE
  26686. æTN A835
  26687. æD PROCEDURE FontMetrics(theMetrics: FMetricRec);
  26688.     INLINE $A835;
  26689. æDT FontMetrics(theMetrics);
  26690. æMM
  26691. æRI IV-32
  26692. æC  
  26693. Note:  The extensions to the Font Manager described in the following paragraphs
  26694.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26695.        this information refers to the 128K ROMs and System file version 3.2
  26696.        and later.
  26697.  
  26698. To improve the speed and readability of text display in your application, use the
  26699. SetFractEnable and SetFScaleDisable procedures to enable fractional character widths
  26700. and disable font scaling. Certain applications do not work properly when fractional
  26701. character widths are used and font scaling is disabled, so these features are turned
  26702. off by default.
  26703.  
  26704. The FontMetrics function is much like QuickDraw’s GetFontInfo function except that it
  26705. returns fixed-point values, letting you draw characters in more precise locations on
  26706. the screen.
  26707.  
  26708. If there’s a 'FOND' resource associated with the most recently drawn font, making the
  26709. font resource purgeable or unpurgeable with the SetFontLock procedure will make the
  26710. 'FOND' resource resource purgeable or unpurgeable as well.
  26711.  
  26712. PROCEDURE FontMetrics (VAR theMetrics:  FMetricRec);
  26713.  
  26714. FontMetrics is similar to the QuickDraw procedure GetFontInfo except that it returns
  26715. fixed-point values for greater accuracy in high-resolution printing.
  26716.  
  26717. The FMetricRec data structure is defined as follows:
  26718.  
  26719. TYPE FMetricRec = RECORD
  26720.                     ascent:      Fixed;    {ascent}
  26721.                     descent:     Fixed;    {descent}
  26722.                     leading:     Fixed;    {leading}
  26723.                     widMax:      Fixed;    {maximum character width}
  26724.                     wTabHandle:  Handle;   {handle to global width table}
  26725.                   END;
  26726.  
  26727. Ascent, descent, leading, and widMax are identical in function to their counterparts
  26728. in GetFontInfo. WTabHandle is a handle to the global width table
  26729. (described below).
  26730.  
  26731. æKY SetFractEnable
  26732. æFp Fonts.p
  26733. æT PROCEDURE
  26734. æD PROCEDURE SetFractEnable(fractEnable: BOOLEAN);
  26735. æDT SetFractEnable(fractEnable);
  26736. æRT 72
  26737. æRI V-180
  26738. æC  
  26739. Note:  The extensions to the Font Manager described in the following paragraphs
  26740.        were originally documented in Inside Macintosh, Volume IV.  As such,
  26741.        this information refers to the 128K ROMs and System file version 3.2
  26742.        and later.
  26743.  
  26744. SetFractEnable lets you enable or disable fractional character widths. If fractEnable
  26745. is TRUE, fractional character widths are enabled; if it’s FALSE, the Font Manager
  26746. uses integer widths. To ensure compatibility with existing applications, fractional
  26747. character widths are disabled by default.
  26748.  
  26749. SetFractEnable, which was not in the 128K ROM (but was available in the Pascal interfaces)
  26750. has been added to both the Macintosh SE and Macintosh II ROMs.
  26751.  
  26752. Assembly-language note:   Assembly-language programmers should call
  26753.                           SetFractEnable rather than change the value
  26754.                           of the global variable FractEnable.
  26755.  
  26756.  
  26757. æKY GestaltEqu.p
  26758. æKL Gestalt
  26759. NewGestalt
  26760. ReplaceGestalt
  26761.  
  26762. gestalt32BitAddressing
  26763. gestalt32BitCapable
  26764. gestalt32BitQD
  26765. gestalt32BitSysZone
  26766. gestalt68000
  26767. gestalt68010
  26768. gestalt68020
  26769. gestalt68030
  26770. gestalt68030MMU
  26771. gestalt68040
  26772. gestalt68040FPU
  26773. gestalt68040MMU
  26774. gestalt68851
  26775. gestalt68881
  26776. gestalt68882
  26777. gestalt8BitQD
  26778. gestaltAddressingModeAttr
  26779. gestaltAliasMgrAttr
  26780. gestaltAliasMgrPresent
  26781. gestaltAMU
  26782. gestaltAppleEventsAttr
  26783. gestaltAppleEventsPresent
  26784. gestaltAppleTalkVersion
  26785. gestaltAUXVersion
  26786. gestaltClassic
  26787. gestaltCTBVersion
  26788. gestaltDBAccessMgrAttr
  26789. gestaltDBAccessMgrPresent
  26790. gestaltDupSelectorErr
  26791. gestaltEditionMgrAttr
  26792. gestaltEditionMgrPresent
  26793. gestaltElmerISOKbd
  26794. gestaltElmerKbd
  26795. gestaltExtADBKbd
  26796. gestaltExtendedTimeMgr
  26797. gestaltExtISOADBKbd
  26798. gestaltFolderMgrAttr
  26799. gestaltFolderMgrPresent
  26800. gestaltFontMgrAttr
  26801. gestaltFPUType
  26802. gestaltHardwareAttr
  26803. gestaltHasASC
  26804. gestaltHasParityCapability
  26805. gestaltHasSCC
  26806. gestaltHasSCSI
  26807. gestaltHasVIA1
  26808. gestaltHasVIA2
  26809. gestaltHelpMgrAttr
  26810. gestaltHelpMgrPresent
  26811. gestaltIPCSupport
  26812. gestaltKeyboardType
  26813. gestaltLaunchCanReturn
  26814. gestaltLaunchControl
  26815. gestaltLaunchFullFileSpec
  26816. gestaltLocationErr
  26817. gestaltLogicalPageSize
  26818. gestaltLogicalRAMSize
  26819. gestaltLowMemorySize
  26820. gestaltMac512KE
  26821. gestaltMacAndPad
  26822. gestaltMachineType
  26823. gestaltMacII
  26824. gestaltMacIIci
  26825. gestaltMacIIcx
  26826. gestaltMacIIfx
  26827. gestaltMacIIx
  26828. gestaltMacKbd
  26829. gestaltMacPlus
  26830. gestaltMacPlusKbd
  26831. gestaltMacSE
  26832. gestaltMacSE030
  26833. gestaltMacXL
  26834. gestaltMiscAttr
  26835. gestaltMMUType
  26836. gestaltNoFPU
  26837. gestaltNoMMU
  26838. gestaltNotificationMgrAttr
  26839. gestaltNotificationPresent
  26840. gestaltOriginalQD
  26841. gestaltOSAttr
  26842. gestaltOutlineFonts
  26843. gestaltParityAttr
  26844. gestaltParityEnabled
  26845. gestaltPartialRsrcs
  26846. gestaltPhysicalRAMSize
  26847. gestaltPMgrCPUIdle
  26848. gestaltPMgrExists
  26849. gestaltPMgrSCC
  26850. gestaltPMgrSound
  26851. gestaltPortable
  26852. gestaltPowerMgrAttr
  26853. gestaltPPCSupportsDontCare
  26854. gestaltPPCSupportsIncomming
  26855. gestaltPPCSupportsOutGoing
  26856. gestaltPPCSupportsRealTime
  26857. gestaltPPCSupportsStoreAndForward
  26858. gestaltPPCToolboxAttr
  26859. gestaltPPCToolboxPresent
  26860. gestaltProcessorType
  26861. gestaltPrtblADBKbd
  26862. gestaltPrtblISOKbd
  26863. gestaltQuickdrawVersion
  26864. gestaltRealTempMemory
  26865. gestaltResourceMgrAttr
  26866. gestaltRevisedTimeMgr
  26867. gestaltROMSize
  26868. gestaltROMVersion
  26869. gestaltScriptCount
  26870. gestaltScriptMgrVersion
  26871. gestaltScrollingThrottle
  26872. gestaltSoundAttr
  26873. gestaltStandardTimeMgr
  26874. gestaltStdADBKbd
  26875. gestaltStdISOADBKbd
  26876. gestaltStereoCapability
  26877. gestaltStereoMixing
  26878. gestaltSysDebuggerSupport
  26879. gestaltSystemVersion
  26880. gestaltSysZoneGrowable
  26881. gestaltTE1
  26882. gestaltTE2
  26883. gestaltTE3
  26884. gestaltTE4
  26885. gestaltTempMemSupport
  26886. gestaltTempMemTracked
  26887. gestaltTextEditVersion
  26888. gestaltTimeMgrVersion
  26889. gestaltUndefSelectorErr
  26890. gestaltUnknownErr
  26891. gestaltVersion
  26892. gestaltVMAttr
  26893. gestaltVMPresent
  26894.  
  26895. æKY gestaltUnknownErr
  26896. æFp GestaltEqu.p
  26897. æT CONST
  26898. æD 
  26899. { ***********************
  26900.  *    Gestalt error codes
  26901.  *********************** }
  26902.  
  26903. gestaltUnknownErr = -5550; { value returned if Gestalt doesn't know the answer }
  26904. æC 
  26905.  
  26906. æKY gestaltUndefSelectorErr
  26907. æFp GestaltEqu.p
  26908. æT CONST
  26909. æD gestaltUndefSelectorErr = -5551; { undefined selector was passed to Gestalt }
  26910. æC 
  26911.  
  26912. æKY gestaltDupSelectorErr
  26913. æFp GestaltEqu.p
  26914. æT CONST
  26915. æD gestaltDupSelectorErr = -5552; { tried to add an entry that already existed }
  26916. æC 
  26917.  
  26918. æKY gestaltLocationErr
  26919. æFp GestaltEqu.p
  26920. æT CONST
  26921. æD gestaltLocationErr = -5553; { gestalt function ptr wasn't in sysheap }
  26922. æC 
  26923.  
  26924. æKY gestaltVersion
  26925. æFp GestaltEqu.p
  26926. æT CONST
  26927. æD 
  26928. { *************************
  26929.  *    Environment Selectors
  26930.  ************************* }
  26931.  
  26932. gestaltVersion = 'vers'; { gestalt version }
  26933. æC 
  26934.  
  26935. æKY gestaltAddressingModeAttr
  26936. æFp GestaltEqu.p
  26937. æT CONST
  26938. æD gestaltAddressingModeAttr = 'addr'; { addressing mode attributes }
  26939. æC 
  26940.  
  26941. æKY gestalt32BitAddressing
  26942. æFp GestaltEqu.p
  26943. æT CONST
  26944. æD gestalt32BitAddressing = 0; { using 32-bit addressing mode }
  26945. æC 
  26946.  
  26947. æKY gestalt32BitSysZone
  26948. æFp GestaltEqu.p
  26949. æT CONST
  26950. æD gestalt32BitSysZone = 1; { 32-bit compatible system zone }
  26951. æC 
  26952.  
  26953. æKY gestalt32BitCapable
  26954. æFp GestaltEqu.p
  26955. æT CONST
  26956. æD gestalt32BitCapable = 2; { Machine is 32-bit capable }
  26957. æC 
  26958.  
  26959. æKY gestaltAliasMgrAttr
  26960. æFp GestaltEqu.p
  26961. æT CONST
  26962. æD gestaltAliasMgrAttr = 'alis'; { Alias Mgr Attributes }
  26963. æC 
  26964.  
  26965. æKY gestaltAliasMgrPresent
  26966. æFp GestaltEqu.p
  26967. æT CONST
  26968. æD gestaltAliasMgrPresent = 0; { True if the Alias Mgr is present }
  26969. æC 
  26970.  
  26971. æKY gestaltAppleTalkVersion
  26972. æFp GestaltEqu.p
  26973. æT CONST
  26974. æD gestaltAppleTalkVersion = 'atlk'; { appletalk version }
  26975. æC 
  26976.  
  26977. æKY gestaltAUXVersion
  26978. æFp GestaltEqu.p
  26979. æT CONST
  26980. æD gestaltAUXVersion = 'a/ux'; {a/ux version, if present }
  26981. æC 
  26982.  
  26983. æKY gestaltCTBVersion
  26984. æFp GestaltEqu.p
  26985. æT CONST
  26986. æD gestaltCTBVersion = 'ctbv'; { CommToolbox version }
  26987. æC 
  26988.  
  26989. æKY gestaltDBAccessMgrAttr
  26990. æFp GestaltEqu.p
  26991. æT CONST
  26992. æD gestaltDBAccessMgrAttr = 'dbac'; { Database Access Mgr attributes }
  26993. æC 
  26994.  
  26995. æKY gestaltDBAccessMgrPresent
  26996. æFp GestaltEqu.p
  26997. æT CONST
  26998. æD gestaltDBAccessMgrPresent = 0; { True if Database Access Mgr present }
  26999. æC 
  27000.  
  27001. æKY gestaltEditionMgrAttr
  27002. æFp GestaltEqu.p
  27003. æT CONST
  27004. æD gestaltEditionMgrAttr = 'edtn'; { Edition Mgr attributes }
  27005. æC 
  27006.  
  27007. æKY gestaltEditionMgrPresent
  27008. æFp GestaltEqu.p
  27009. æT CONST
  27010. æD gestaltEditionMgrPresent = 0; { True if Edition Mgr present }
  27011. æC 
  27012.  
  27013. æKY gestaltAppleEventsAttr
  27014. æFp GestaltEqu.p
  27015. æT CONST
  27016. æD gestaltAppleEventsAttr = 'evnt'; { Apple Events attributes }
  27017. æC 
  27018.  
  27019. æKY gestaltAppleEventsPresent
  27020. æFp GestaltEqu.p
  27021. æT CONST
  27022. æD gestaltAppleEventsPresent = 0; { True if Apple Events present }
  27023. æC 
  27024.  
  27025. æKY gestaltFolderMgrAttr
  27026. æFp GestaltEqu.p
  27027. æT CONST
  27028. æD gestaltFolderMgrAttr = 'fold'; { Folder Mgr attributes }
  27029. æC 
  27030.  
  27031. æKY gestaltFolderMgrPresent
  27032. æFp GestaltEqu.p
  27033. æT CONST
  27034. æD gestaltFolderMgrPresent = 0; { True if Folder Mgr present }
  27035. æC 
  27036.  
  27037. æKY gestaltFontMgrAttr
  27038. æFp GestaltEqu.p
  27039. æT CONST
  27040. æD gestaltFontMgrAttr = 'font'; { Font Mgr attributes }
  27041. æC 
  27042.  
  27043. æKY gestaltOutlineFonts
  27044. æFp GestaltEqu.p
  27045. æT CONST
  27046. æD gestaltOutlineFonts = 0; { True if Outline Fonts supported }
  27047. æC 
  27048.  
  27049. æKY gestaltFPUType
  27050. æFp GestaltEqu.p
  27051. æT CONST
  27052. æD gestaltFPUType = 'fpu '; { fpu type }
  27053. æC 
  27054.  
  27055. æKY gestaltNoFPU
  27056. æFp GestaltEqu.p
  27057. æT CONST
  27058. æD gestaltNoFPU = 0; { no FPU }
  27059. æC 
  27060.  
  27061. æKY gestalt68881
  27062. æFp GestaltEqu.p
  27063. æT CONST
  27064. æD gestalt68881 = 1; { 68881 FPU }
  27065. æC 
  27066.  
  27067. æKY gestalt68882
  27068. æFp GestaltEqu.p
  27069. æT CONST
  27070. æD gestalt68882 = 2; { 68882 FPU }
  27071. æC 
  27072.  
  27073. æKY gestalt68040FPU
  27074. æFp GestaltEqu.p
  27075. æT CONST
  27076. æD gestalt68040FPU = 3; { 68040 built-in FPU }
  27077. æC 
  27078.  
  27079. æKY gestaltHardwareAttr
  27080. æFp GestaltEqu.p
  27081. æT CONST
  27082. æD gestaltHardwareAttr = 'hdwr'; { hardware attributes }
  27083. æC 
  27084.  
  27085. æKY gestaltHasVIA1
  27086. æFp GestaltEqu.p
  27087. æT CONST
  27088. æD gestaltHasVIA1 = 0; { VIA1 exists }
  27089. æC 
  27090.  
  27091. æKY gestaltHasVIA2
  27092. æFp GestaltEqu.p
  27093. æT CONST
  27094. æD gestaltHasVIA2 = 1; { VIA2 exists }
  27095. æC 
  27096.  
  27097. æKY gestaltHasASC
  27098. æFp GestaltEqu.p
  27099. æT CONST
  27100. æD gestaltHasASC = 3; { Apple Sound Chip exists }
  27101. æC 
  27102.  
  27103. æKY gestaltHasSCC
  27104. æFp GestaltEqu.p
  27105. æT CONST
  27106. æD gestaltHasSCC = 4; { SCC exists }
  27107. æC 
  27108.  
  27109. æKY gestaltHasSCSI
  27110. æFp GestaltEqu.p
  27111. æT CONST
  27112. æD gestaltHasSCSI = 7; { SCSI exists }
  27113. æC 
  27114.  
  27115. æKY gestaltHelpMgrAttr
  27116. æFp GestaltEqu.p
  27117. æT CONST
  27118. æD gestaltHelpMgrAttr = 'help'; { Help Mgr Attributes }
  27119. æC 
  27120.  
  27121. æKY gestaltHelpMgrPresent
  27122. æFp GestaltEqu.p
  27123. æT CONST
  27124. æD gestaltHelpMgrPresent = 0; { true if help mgr is present }
  27125. æC 
  27126.  
  27127. æKY gestaltKeyboardType
  27128. æFp GestaltEqu.p
  27129. æT CONST
  27130. æD gestaltKeyboardType = 'kbd '; { keyboard type }
  27131. æC 
  27132.  
  27133. æKY gestaltMacKbd
  27134. æFp GestaltEqu.p
  27135. æT CONST
  27136. æD gestaltMacKbd = 1;
  27137. æC 
  27138.  
  27139. æKY gestaltMacAndPad
  27140. æFp GestaltEqu.p
  27141. æT CONST
  27142. æD gestaltMacAndPad = 2;
  27143. æC 
  27144.  
  27145. æKY gestaltMacPlusKbd
  27146. æFp GestaltEqu.p
  27147. æT CONST
  27148. æD gestaltMacPlusKbd = 3;
  27149. æC 
  27150.  
  27151. æKY gestaltExtADBKbd
  27152. æFp GestaltEqu.p
  27153. æT CONST
  27154. æD gestaltExtADBKbd = 4;
  27155. æC 
  27156.  
  27157. æKY gestaltStdADBKbd
  27158. æFp GestaltEqu.p
  27159. æT CONST
  27160. æD gestaltStdADBKbd = 5;
  27161. æC 
  27162.  
  27163. æKY gestaltPrtblADBKbd
  27164. æFp GestaltEqu.p
  27165. æT CONST
  27166. æD gestaltPrtblADBKbd = 6;
  27167. æC 
  27168.  
  27169. æKY gestaltPrtblISOKbd
  27170. æFp GestaltEqu.p
  27171. æT CONST
  27172. æD gestaltPrtblISOKbd = 7;
  27173. æC 
  27174.  
  27175. æKY gestaltStdISOADBKbd
  27176. æFp GestaltEqu.p
  27177. æT CONST
  27178. æD gestaltStdISOADBKbd = 8;
  27179. æC 
  27180.  
  27181. æKY gestaltExtISOADBKbd
  27182. æFp GestaltEqu.p
  27183. æT CONST
  27184. æD gestaltExtISOADBKbd = 9;
  27185. æC 
  27186.  
  27187. æKY gestaltElmerKbd
  27188. æFp GestaltEqu.p
  27189. æT CONST
  27190. æD gestaltElmerKbd = 10;
  27191. æC 
  27192.  
  27193. æKY gestaltElmerISOKbd
  27194. æFp GestaltEqu.p
  27195. æT CONST
  27196. æD gestaltElmerISOKbd = 11;
  27197. æC 
  27198.  
  27199. æKY gestaltLowMemorySize
  27200. æFp GestaltEqu.p
  27201. æT CONST
  27202. æD gestaltLowMemorySize = 'lmem'; { size of low memory area }
  27203. æC 
  27204.  
  27205. æKY gestaltLogicalRAMSize
  27206. æFp GestaltEqu.p
  27207. æT CONST
  27208. æD gestaltLogicalRAMSize = 'lram'; { logical ram size }
  27209. æC 
  27210.  
  27211. æKY gestaltMiscAttr
  27212. æFp GestaltEqu.p
  27213. æT CONST
  27214. æD gestaltMiscAttr = 'misc'; { miscellaneous attributes }
  27215. æC 
  27216.  
  27217. æKY gestaltScrollingThrottle
  27218. æFp GestaltEqu.p
  27219. æT CONST
  27220. æD gestaltScrollingThrottle = 0; { true if scrolling throttle on }
  27221. æC 
  27222.  
  27223. æKY gestaltMMUType
  27224. æFp GestaltEqu.p
  27225. æT CONST
  27226. æD gestaltMMUType = 'mmu '; { mmu type }
  27227. æC 
  27228.  
  27229. æKY gestaltNoMMU
  27230. æFp GestaltEqu.p
  27231. æT CONST
  27232. æD gestaltNoMMU = 0; { no MMU }
  27233. æC 
  27234.  
  27235. æKY gestaltAMU
  27236. æFp GestaltEqu.p
  27237. æT CONST
  27238. æD gestaltAMU = 1; { address management unit }
  27239. æC 
  27240.  
  27241. æKY gestalt68851
  27242. æFp GestaltEqu.p
  27243. æT CONST
  27244. æD gestalt68851 = 2; { 68851 PMMU }
  27245. æC 
  27246.  
  27247. æKY gestalt68030MMU
  27248. æFp GestaltEqu.p
  27249. æT CONST
  27250. æD gestalt68030MMU = 3; { 68030 built-in MMU }
  27251. æC 
  27252.  
  27253. æKY gestalt68040MMU
  27254. æFp GestaltEqu.p
  27255. æT CONST
  27256. æD gestalt68040MMU = 4; { 68040 built-in MMU }
  27257. æC 
  27258.  
  27259. æKY gestaltNotificationMgrAttr
  27260. æFp GestaltEqu.p
  27261. æT CONST
  27262. æD gestaltNotificationMgrAttr = 'nmgr'; { notification manager attributes }
  27263. æC 
  27264.  
  27265. æKY gestaltNotificationPresent
  27266. æFp GestaltEqu.p
  27267. æT CONST
  27268. æD gestaltNotificationPresent = 0; { notification manager exists }
  27269. æC 
  27270.  
  27271. æKY gestaltOSAttr
  27272. æFp GestaltEqu.p
  27273. æT CONST
  27274. æD gestaltOSAttr = 'os  '; { o/s attributes }
  27275. æC 
  27276.  
  27277. æKY gestaltSysZoneGrowable
  27278. æFp GestaltEqu.p
  27279. æT CONST
  27280. æD gestaltSysZoneGrowable = 0; { system heap is growable }
  27281. æC 
  27282.  
  27283. æKY gestaltLaunchCanReturn
  27284. æFp GestaltEqu.p
  27285. æT CONST
  27286. æD gestaltLaunchCanReturn = 1; { can return from launch }
  27287. æC 
  27288.  
  27289. æKY gestaltLaunchFullFileSpec
  27290. æFp GestaltEqu.p
  27291. æT CONST
  27292. æD gestaltLaunchFullFileSpec = 2; { can launch from full file spec }
  27293. æC 
  27294.  
  27295. æKY gestaltLaunchControl
  27296. æFp GestaltEqu.p
  27297. æT CONST
  27298. æD gestaltLaunchControl = 3; { launch control support available }
  27299. æC 
  27300.  
  27301. æKY gestaltTempMemSupport
  27302. æFp GestaltEqu.p
  27303. æT CONST
  27304. æD gestaltTempMemSupport = 4; { temp memory support }
  27305. æC 
  27306.  
  27307. æKY gestaltRealTempMemory
  27308. æFp GestaltEqu.p
  27309. æT CONST
  27310. æD gestaltRealTempMemory = 5; { temp memory handles are real }
  27311. æC 
  27312.  
  27313. æKY gestaltTempMemTracked
  27314. æFp GestaltEqu.p
  27315. æT CONST
  27316. æD gestaltTempMemTracked = 6; { temporary memory handles are tracked }
  27317. æC 
  27318.  
  27319. æKY gestaltIPCSupport
  27320. æFp GestaltEqu.p
  27321. æT CONST
  27322. æD gestaltIPCSupport = 7; { IPC support is present }
  27323. æC 
  27324.  
  27325. æKY gestaltSysDebuggerSupport
  27326. æFp GestaltEqu.p
  27327. æT CONST
  27328. æD gestaltSysDebuggerSupport = 8; { system debugger support is present }
  27329. æC 
  27330.  
  27331. æKY gestaltLogicalPageSize
  27332. æFp GestaltEqu.p
  27333. æT CONST
  27334. æD gestaltLogicalPageSize = 'pgsz'; { logical page size }
  27335. æC 
  27336.  
  27337. æKY gestaltPowerMgrAttr
  27338. æFp GestaltEqu.p
  27339. æT CONST
  27340. æD gestaltPowerMgrAttr = 'powr'; { power manager attributes }
  27341. æC 
  27342.  
  27343. æKY gestaltPMgrExists
  27344. æFp GestaltEqu.p
  27345. æT CONST
  27346. æD gestaltPMgrExists = 0;
  27347. æC 
  27348.  
  27349. æKY gestaltPMgrCPUIdle
  27350. æFp GestaltEqu.p
  27351. æT CONST
  27352. æD gestaltPMgrCPUIdle = 1;
  27353. æC 
  27354.  
  27355. æKY gestaltPMgrSCC
  27356. æFp GestaltEqu.p
  27357. æT CONST
  27358. æD gestaltPMgrSCC = 2;
  27359. æC 
  27360.  
  27361. æKY gestaltPMgrSound
  27362. æFp GestaltEqu.p
  27363. æT CONST
  27364. æD gestaltPMgrSound = 3;
  27365. æC 
  27366.  
  27367. æKY gestaltPPCToolboxAttr
  27368. æFp GestaltEqu.p
  27369. æT CONST
  27370. æD gestaltPPCToolboxAttr = 'ppc '; { PPC toolbox attributes }
  27371. æC 
  27372.  
  27373. æKY gestaltPPCToolboxPresent
  27374. æFp GestaltEqu.p
  27375. æT CONST
  27376. æD 
  27377.  * PPC will return the combination of following bit fields.
  27378.  * e.g. gestaltPPCSupportsRealTime +gestaltPPCSupportsIncomming + gestaltPPCSupportsOutGoing
  27379.  * indicates PPC is cuurently is only supports real time delivery
  27380.  * and both icoming and outgoing network sessions are allowed.
  27381.  * By default local real time delivery is supported as long as PPCInit has been called.
  27382.  }
  27383.  
  27384. gestaltPPCToolboxPresent = $0000; { PPC Toolbox is present  Requires PPCInit to be called }
  27385. æC 
  27386.  
  27387. æKY gestaltPPCSupportsRealTime
  27388. æFp GestaltEqu.p
  27389. æT CONST
  27390. æD gestaltPPCSupportsRealTime = $1000; { PPC Supports real-time delivery }
  27391. æC 
  27392.  
  27393. æKY gestaltPPCSupportsStoreAndForward
  27394. æFp GestaltEqu.p
  27395. æT CONST
  27396. æD gestaltPPCSupportsStoreAndForward = $2000; { PPC Store and Forward  delivery }
  27397. æC 
  27398.  
  27399. æKY gestaltPPCSupportsDontCare
  27400. æFp GestaltEqu.p
  27401. æT CONST
  27402. æD gestaltPPCSupportsDontCare = $4000; { PPC Supports  Specification of Don't care }
  27403. æC 
  27404.  
  27405. æKY gestaltPPCSupportsIncomming
  27406. æFp GestaltEqu.p
  27407. æT CONST
  27408. æD gestaltPPCSupportsIncomming = $0001; { PPC will deny incomming network requests }
  27409. æC 
  27410.  
  27411. æKY gestaltPPCSupportsOutGoing
  27412. æFp GestaltEqu.p
  27413. æT CONST
  27414. æD gestaltPPCSupportsOutGoing = $0002; { PPC will deny outgoing network requests }
  27415. æC 
  27416.  
  27417. æKY gestaltProcessorType
  27418. æFp GestaltEqu.p
  27419. æT CONST
  27420. æD gestaltProcessorType = 'proc'; { processor type }
  27421. æC 
  27422.  
  27423. æKY gestalt68000
  27424. æFp GestaltEqu.p
  27425. æT CONST
  27426. æD gestalt68000 = 1;
  27427. æC 
  27428.  
  27429. æKY gestalt68010
  27430. æFp GestaltEqu.p
  27431. æT CONST
  27432. æD gestalt68010 = 2;
  27433. æC 
  27434.  
  27435. æKY gestalt68020
  27436. æFp GestaltEqu.p
  27437. æT CONST
  27438. æD gestalt68020 = 3;
  27439. æC 
  27440.  
  27441. æKY gestalt68030
  27442. æFp GestaltEqu.p
  27443. æT CONST
  27444. æD gestalt68030 = 4;
  27445. æC 
  27446.  
  27447. æKY gestalt68040
  27448. æFp GestaltEqu.p
  27449. æT CONST
  27450. æD gestalt68040 = 5;
  27451. æC 
  27452.  
  27453. æKY gestaltParityAttr
  27454. æFp GestaltEqu.p
  27455. æT CONST
  27456. æD gestaltParityAttr = 'prty'; { parity attributes }
  27457. æC 
  27458.  
  27459. æKY gestaltHasParityCapability
  27460. æFp GestaltEqu.p
  27461. æT CONST
  27462. æD gestaltHasParityCapability = 0; { has ability to check parity }
  27463. æC 
  27464.  
  27465. æKY gestaltParityEnabled
  27466. æFp GestaltEqu.p
  27467. æT CONST
  27468. æD gestaltParityEnabled = 1; { parity checking enabled }
  27469. æC 
  27470.  
  27471. æKY gestaltQuickdrawVersion
  27472. æFp GestaltEqu.p
  27473. æT CONST
  27474. æD gestaltQuickdrawVersion = 'qd  '; { quickdraw version }
  27475. æC 
  27476.  
  27477. æKY gestaltOriginalQD
  27478. æFp GestaltEqu.p
  27479. æT CONST
  27480. æD gestaltOriginalQD = $000; { original 1-bit QD            <3.2> }
  27481. æC 
  27482.  
  27483. æKY gestalt8BitQD
  27484. æFp GestaltEqu.p
  27485. æT CONST
  27486. æD gestalt8BitQD = $100; { 8-bit color QD                <3.2> }
  27487. æC 
  27488.  
  27489. æKY gestalt32BitQD
  27490. æFp GestaltEqu.p
  27491. æT CONST
  27492. æD gestalt32BitQD = $200; { 32-bit color QD                <3.2> }
  27493. æC 
  27494.  
  27495. æKY gestaltPhysicalRAMSize
  27496. æFp GestaltEqu.p
  27497. æT CONST
  27498. æD gestaltPhysicalRAMSize = 'ram '; { physical RAM size }
  27499. æC 
  27500.  
  27501. æKY gestaltResourceMgrAttr
  27502. æFp GestaltEqu.p
  27503. æT CONST
  27504. æD gestaltResourceMgrAttr = 'rsrc'; { Resource Mgr attributes }
  27505. æC 
  27506.  
  27507. æKY gestaltPartialRsrcs
  27508. æFp GestaltEqu.p
  27509. æT CONST
  27510. æD gestaltPartialRsrcs = 0; { True if partial resources exist }
  27511. æC 
  27512.  
  27513. æKY gestaltScriptMgrVersion
  27514. æFp GestaltEqu.p
  27515. æT CONST
  27516. æD gestaltScriptMgrVersion = 'scri'; { Script Manager version number    <08/05/89 pke> }
  27517. æC 
  27518.  
  27519. æKY gestaltScriptCount
  27520. æFp GestaltEqu.p
  27521. æT CONST
  27522. æD gestaltScriptCount = 'scr#'; { number of active script systems    <08/05/89 pke> }
  27523. æC 
  27524.  
  27525. æKY gestaltSoundAttr
  27526. æFp GestaltEqu.p
  27527. æT CONST
  27528. æD gestaltSoundAttr = 'snd '; { sound attributes }
  27529. æC 
  27530.  
  27531. æKY gestaltStereoCapability
  27532. æFp GestaltEqu.p
  27533. æT CONST
  27534. æD gestaltStereoCapability = 0; { sound hardware has stereo capability }
  27535. æC 
  27536.  
  27537. æKY gestaltStereoMixing
  27538. æFp GestaltEqu.p
  27539. æT CONST
  27540. æD gestaltStereoMixing = 1; { stereo mixing on external speaker }
  27541. æC 
  27542.  
  27543. æKY gestaltTextEditVersion
  27544. æFp GestaltEqu.p
  27545. æT CONST
  27546. æD gestaltTextEditVersion = 'te  '; { TextEdit version number            <08/05/89 pke> }
  27547. æC 
  27548.  
  27549. æKY gestaltTE1
  27550. æFp GestaltEqu.p
  27551. æT CONST
  27552. æD gestaltTE1 = 1; { TextEdit in MacIIci ROM <8Aug89smb> }
  27553. æC 
  27554.  
  27555. æKY gestaltTE2
  27556. æFp GestaltEqu.p
  27557. æT CONST
  27558. æD gestaltTE2 = 2; { TextEdit with 6.0.4 Script Systems on MacIIci (Script bug fixes for MacIIci) <8Aug89smb> }
  27559. æC 
  27560.  
  27561. æKY gestaltTE3
  27562. æFp GestaltEqu.p
  27563. æT CONST
  27564. æD gestaltTE3 = 3; { TextEdit with 6.0.4 Script Systems all but MacIIci <8Aug89smb> }
  27565. æC 
  27566.  
  27567. æKY gestaltTE4
  27568. æFp GestaltEqu.p
  27569. æT CONST
  27570. æD 
  27571. {  **** Following is for System 7.0 Only **** }
  27572.  
  27573. gestaltTE4 = 4; { TextEdit in System 7.0}
  27574. æC 
  27575.  
  27576. æKY gestaltTimeMgrVersion
  27577. æFp GestaltEqu.p
  27578. æT CONST
  27579. æD gestaltTimeMgrVersion = 'tmgr'; { time mgr version }
  27580. æC 
  27581.  
  27582. æKY gestaltStandardTimeMgr
  27583. æFp GestaltEqu.p
  27584. æT CONST
  27585. æD gestaltStandardTimeMgr = 1; { standard time mgr is present }
  27586. æC 
  27587.  
  27588. æKY gestaltRevisedTimeMgr
  27589. æFp GestaltEqu.p
  27590. æT CONST
  27591. æD gestaltRevisedTimeMgr = 2; { revised time mgr is present }
  27592. æC 
  27593.  
  27594. æKY gestaltExtendedTimeMgr
  27595. æFp GestaltEqu.p
  27596. æT CONST
  27597. æD gestaltExtendedTimeMgr = 3; { extended time mgr is present }
  27598. æC 
  27599.  
  27600. æKY gestaltVMAttr
  27601. æFp GestaltEqu.p
  27602. æT CONST
  27603. æD gestaltVMAttr = 'vm  '; { virtual memory attributes }
  27604. æC 
  27605.  
  27606. æKY gestaltVMPresent
  27607. æFp GestaltEqu.p
  27608. æT CONST
  27609. æD gestaltVMPresent = 0; { true if virtual memory is present }
  27610. æC 
  27611.  
  27612. æKY gestaltMachineType
  27613. æFp GestaltEqu.p
  27614. æT CONST
  27615. æD 
  27616. { ************************
  27617.  *    Info-only selectors
  27618.  *********************** }
  27619.  
  27620. gestaltMachineType = 'mach'; { machine type }
  27621. æC 
  27622.  
  27623. æKY gestaltClassic
  27624. æFp GestaltEqu.p
  27625. æT CONST
  27626. æD gestaltClassic = 1;
  27627. æC 
  27628.  
  27629. æKY gestaltMacXL
  27630. æFp GestaltEqu.p
  27631. æT CONST
  27632. æD gestaltMacXL = 2;
  27633. æC 
  27634.  
  27635. æKY gestaltMac512KE
  27636. æFp GestaltEqu.p
  27637. æT CONST
  27638. æD gestaltMac512KE = 3;
  27639. æC 
  27640.  
  27641. æKY gestaltMacPlus
  27642. æFp GestaltEqu.p
  27643. æT CONST
  27644. æD gestaltMacPlus = 4;
  27645. æC 
  27646.  
  27647. æKY gestaltMacSE
  27648. æFp GestaltEqu.p
  27649. æT CONST
  27650. æD gestaltMacSE = 5;
  27651. æC 
  27652.  
  27653. æKY gestaltMacII
  27654. æFp GestaltEqu.p
  27655. æT CONST
  27656. æD gestaltMacII = 6;
  27657. æC 
  27658.  
  27659. æKY gestaltMacIIx
  27660. æFp GestaltEqu.p
  27661. æT CONST
  27662. æD gestaltMacIIx = 7;
  27663. æC 
  27664.  
  27665. æKY gestaltMacIIcx
  27666. æFp GestaltEqu.p
  27667. æT CONST
  27668. æD gestaltMacIIcx = 8;
  27669. æC 
  27670.  
  27671. æKY gestaltMacSE030
  27672. æFp GestaltEqu.p
  27673. æT CONST
  27674. æD gestaltMacSE030 = 9;
  27675. æC 
  27676.  
  27677. æKY gestaltPortable
  27678. æFp GestaltEqu.p
  27679. æT CONST
  27680. æD gestaltPortable = 10;
  27681. æC 
  27682.  
  27683. æKY gestaltMacIIci
  27684. æFp GestaltEqu.p
  27685. æT CONST
  27686. æD gestaltMacIIci = 11;
  27687. æC 
  27688.  
  27689. æKY gestaltMacIIfx
  27690. æFp GestaltEqu.p
  27691. æT CONST
  27692. æD gestaltMacIIfx = 13;
  27693. æC 
  27694.  
  27695. æKY gestaltROMSize
  27696. æFp GestaltEqu.p
  27697. æT CONST
  27698. æD gestaltROMSize = 'rom '; { rom size }
  27699. æC 
  27700.  
  27701. æKY gestaltROMVersion
  27702. æFp GestaltEqu.p
  27703. æT CONST
  27704. æD gestaltROMVersion = 'romv'; { rom version }
  27705. æC 
  27706.  
  27707. æKY gestaltSystemVersion
  27708. æFp GestaltEqu.p
  27709. æT CONST
  27710. æD gestaltSystemVersion = 'sysv'; { system version}
  27711. æC 
  27712.  
  27713. æKY Gestalt
  27714. æFp GestaltEqu.p
  27715. æT FUNCTION
  27716. æD FUNCTION Gestalt(selector: OSType;VAR response: LONGINT): OSErr;
  27717. æDT myVariable := Gestalt(selector,response);
  27718. æC 
  27719. Use the Gestalt function to obtain information about the operating environment.
  27720. The information you need is indicated by the selector parameter, which Gestalt
  27721. must already recognize.
  27722.  
  27723. Trap macro  _Gestalt
  27724. On entry    D0: selector code
  27725. On exit     A0: response
  27726.             D0: result code
  27727.  
  27728. Upon successful completion of the function, the response parameter contains the
  27729. information requested. Note that Gestalt returns the results from all function
  27730. selectors in a long integer, occupying 4 bytes. In some cases, not all 4 bytes
  27731. are needed to hold the returned information, in which case Gestalt places the
  27732. information in the low-order bytes of the response parameter.
  27733.  
  27734. Result codes
  27735. noErr                        0  No error
  27736. gestaltUnknownErr        –5550  Could not obtain the response
  27737. gestaltUndefSelectorErr  –5551  Undefined selector
  27738.  
  27739. æKY NewGestalt
  27740. æFp GestaltEqu.p
  27741. æT FUNCTION
  27742. æD FUNCTION NewGestalt(selector: OSType;gestaltFunction: ProcPtr): OSErr;
  27743. æDT myVariable := NewGestalt(selector,gestaltFunction);
  27744. æC 
  27745. Use the NewGestalt function to add selector codes to those already recognized by
  27746. Gestalt.
  27747.  
  27748. Trap macro  _NewGestalt
  27749. On entry    A0: address of new selector function
  27750.             D0: selector code
  27751. On exit     D0: result code
  27752.  
  27753. NewGestalt takes as parameters the selector to be registered and the function
  27754. that Gestalt calls when it receives this selector. The interface for the
  27755. selectorFunction function is defined in “Specifying Gestalt Selector Functions”
  27756. earlier in this chapter.
  27757.  
  27758. Result codes
  27759. noErr                      0  No error
  27760. memFullErr              –108  Ran out of memory
  27761. gestaltDupSelectorErr  –5552  Selector already exists
  27762. gestaltLocationErr     –5553  Function not in system heap
  27763.  
  27764. æKY ReplaceGestalt
  27765. æFp GestaltEqu.p
  27766. æT FUNCTION
  27767. æD FUNCTION ReplaceGestalt(selector: OSType;gestaltFunction: ProcPtr;VAR oldGestaltFunction: ProcPtr): OSErr;
  27768. æDT myVariable := ReplaceGestalt(selector,gestaltFunction,oldGestaltFunction);
  27769. æC 
  27770. The ReplaceGestalt function allows an application to replace the function that
  27771. is currently associated with a selector.
  27772.  
  27773. Trap macro  _ReplaceGestalt
  27774. On entry    A0: address of new selector function
  27775.             D0: selector code
  27776. On exit     A0: address of old selector function
  27777.             D0: result code
  27778.  
  27779. The interface for the selectorFunction function is defined in “Specifying
  27780. Gestalt Selector Functions” earlier in this chapter. The new function must
  27781. reside in the system heap and may want to call the function previously
  27782. associated with the named selector. It may do so by using the address returned
  27783. in the parameter oldGestaltFunction. If ReplaceGestalt returns an error of any
  27784. type, then the value of oldGestaltFunction is undefined.
  27785.  
  27786. Result codes
  27787. noErr                        0  No error
  27788. gestaltUndefSelectorErr  –5551  Undefined selector
  27789. gestaltLocationErr       –5553  Function not in system heap
  27790.  
  27791.  
  27792. æKY Globals
  27793. æKL ACount
  27794. ANumber
  27795. ApFontID
  27796. ApplScratch
  27797. AppParmHandle
  27798. DABeeper
  27799. DAStrings
  27800. DefVCBPtr
  27801. DlgFont
  27802. DragPattern
  27803. FCBSPtr
  27804. FinderName
  27805. FScaleDisable
  27806. FSQHdr
  27807. MBarEnable
  27808. MBarHook
  27809. MenuFlash
  27810. MenuHook
  27811. MenuList
  27812. OldContent
  27813. OldStructure
  27814. PrintErr
  27815. ROMFont0
  27816. SaveUpdate
  27817. SaveVisRgn
  27818. TheMenu
  27819. ToExtFS
  27820. ToolScratch
  27821. VCBQHdr
  27822. HiKeyLast
  27823. KbdLast
  27824. PCDeskPat
  27825. Time
  27826. ABusDCE
  27827. ABusVars
  27828. ADBBase
  27829. AlarmState
  27830. ApplLimit
  27831. ApplZone
  27832. ASCBase
  27833. BootDrive
  27834. BufPtr
  27835. BufTgDate
  27836. BufTgFBkNum
  27837. BufTgFFlg
  27838. BufTgFNum
  27839. BusErrVct
  27840. CaretTime
  27841. ChunkyDepth
  27842. ColLines
  27843. CPUFlag
  27844. CrsrAddr
  27845. CrsrBase
  27846. CrsrBusy
  27847. CrsrCouple
  27848. CrsrDevice
  27849. CrsrNew
  27850. CrsrObscure
  27851. CrsrPin
  27852. CrsrPtr
  27853. CrsrRect
  27854. CrsrRow
  27855. CrsrSave
  27856. CrsrScale
  27857. CrsrState
  27858. CrsrThresh
  27859. CrsrVis
  27860. CurActivate
  27861. CurApName
  27862. CurApRefNum
  27863. CurDeactive
  27864. CurDirStore
  27865. CurJTOffset
  27866. CurMap
  27867. CurPageOption
  27868. CurPitch
  27869. CurrentA5
  27870. CurStackBase
  27871. DefltStack
  27872. DeskHook
  27873. DeskPattern
  27874. DeviceList
  27875. DoubleTime
  27876. DragHook
  27877. DrvQHdr
  27878. DSAlertRect
  27879. DSAlertTab
  27880. DSCtrAdj
  27881. DSDrawProc
  27882. DSErrCode
  27883. DskErr
  27884. DskVerify
  27885. DSWndUpdate
  27886. DTQFlags
  27887. DTQueue
  27888. DTskQHdr
  27889. DTskQTail
  27890. EjectNotify
  27891. EndSRTPtr
  27892. EventQueue
  27893. EvtBufCnt
  27894. ExpandMem
  27895. ExtStsDT
  27896. GetParam
  27897. GhostWindow
  27898. GrayRgn
  27899. GZMoveHnd
  27900. GZRootHnd
  27901. GZRootPtr
  27902. HeapEnd
  27903. HiHeapMark
  27904. HiliteMode
  27905. HiliteRGB
  27906. HpChk
  27907. IAZNotify
  27908. IconTLAddr
  27909. IntFlag
  27910. IntlSpec
  27911. IWM
  27912. JAllocCrsr
  27913. JCrsrTask
  27914. JDTInstall
  27915. JFetch
  27916. JGNEFilter
  27917. JIODone
  27918. JKybdTask
  27919. JOpcodeProc
  27920. JournalFlag
  27921. JournalRef
  27922. JSetCCrsr
  27923. JStash
  27924. JSwapMMU
  27925. JVBLTask
  27926. KbdType
  27927. KbdVars
  27928. Key1Trans
  27929. Key2Trans
  27930. KeyLast
  27931. KeyMapLM
  27932. KeyMVars
  27933. KeypadMap
  27934. KeyRepThresh
  27935. KeyRepTime
  27936. KeyThresh
  27937. KeyTime
  27938. LastTxGDevice
  27939. LaunchFlag
  27940. Lo3Bytes
  27941. LoaderPBlock
  27942. LoadTrap
  27943. Lvl1DT
  27944. Lvl2DT
  27945. MainDevice
  27946. MaskBC
  27947. MaskHandle
  27948. MaskPtr
  27949. MBarHeight
  27950. MBState
  27951. MBTicks
  27952. MemErr
  27953. MemTop
  27954. MickeyBytes
  27955. MinStack
  27956. MinusOne
  27957. MMDefFlags
  27958. MmInOK
  27959. MMU32bit
  27960. MMUFlags
  27961. MMUFluff
  27962. MMUTbl
  27963. MMUTblSize
  27964. MMUType
  27965. MonkeyLives
  27966. Mouse
  27967. MouseMask
  27968. MouseOffset
  27969. MTemp
  27970. NewCrsrJTbl
  27971. NMIFlag
  27972. OneOne
  27973. PaintWhite
  27974. PortAUse
  27975. PortBUse
  27976. PortList
  27977. PWMBuf2
  27978. QDColors
  27979. QDErrLM
  27980. QDExist
  27981. RAMBase
  27982. RawMouse
  27983. ResErr
  27984. ResErrProc
  27985. ResLoad
  27986. ResReadOnly
  27987. RestProc
  27988. ResumeProc
  27989. RGBBlack
  27990. RGBWhite
  27991. RndSeed
  27992. ROM85
  27993. ROMBase
  27994. ROMMapHndl
  27995. RomMapInsert
  27996. RowBits
  27997. SaveSegHandle
  27998. SCCASts
  27999. SCCBSts
  28000. SCCRd
  28001. SCCWr
  28002. ScrapCount
  28003. ScrapEnd
  28004. ScrapHandle
  28005. ScrapInfo
  28006. ScrapName
  28007. ScrapSize
  28008. ScrapState
  28009. ScrapTag
  28010. ScrapVars
  28011. Scratch20
  28012. Scratch8
  28013. ScrDmpEnb
  28014. ScrDmpType
  28015. ScreenBytes
  28016. ScreenRow
  28017. ScrHRes
  28018. ScrnBase
  28019. ScrnVBLPtr
  28020. ScrVRes
  28021. SCSIBase
  28022. SCSIDMA
  28023. SCSIGlobals
  28024. SCSIHsk
  28025. SCSIPoll
  28026. SdmBusErr
  28027. SDMJmpTblPtr
  28028. SdVolume
  28029. SegHiEnable
  28030. SerialVars
  28031. SEVarBase
  28032. SEvtEnb
  28033. SFSaveDisk
  28034. SInfoPtr
  28035. SInitFlags
  28036. SlotPrTbl
  28037. SlotQDT
  28038. SlotTICKS
  28039. SlotVBLQ
  28040. SoundActive
  28041. SoundBase
  28042. SoundDCE
  28043. SoundLevel
  28044. SoundPtr
  28045. SoundVBL
  28046. SPAlarm
  28047. SPATalkA
  28048. SPATalkB
  28049. SPClikCaret
  28050. SPConfig
  28051. SPFont
  28052. SPKbd
  28053. SPMisc1
  28054. SPMisc2
  28055. SPPortA
  28056. SPPortB
  28057. SPPrint
  28058. SPValid
  28059. SPVolCtl
  28060. SrcDevice
  28061. SRsrcTblPtr
  28062. StkLowPt
  28063. SwitcherTPtr
  28064. SysEvtBuf
  28065. SysEvtMask
  28066. SysMap
  28067. SysMapHndl
  28068. SysParam
  28069. SysResName
  28070. SysVersion
  28071. SysZone
  28072. TableSeed
  28073. TagData
  28074. TEDoText
  28075. TERecal
  28076. TEScrpHandle
  28077. TEScrpLength
  28078. TESysJust
  28079. TEWdBreak
  28080. TheCrsr
  28081. TheGDevice
  28082. TheZone
  28083. Ticks
  28084. TimeDBRA
  28085. TimeLM
  28086. TimeSCCDB
  28087. TimeSCSIDB
  28088. TmpResLoad
  28089. TopMapHndl
  28090. UnitNtryCnt
  28091. UTableBase
  28092. VBLQueue
  28093. VertRRate
  28094. VIA
  28095. VIA2DT
  28096. VideoInfoOK
  28097. VidMode
  28098. VidType
  28099. WarmStart
  28100. WindowList
  28101. WMgrCPort
  28102. WMgrPort
  28103. WordRedraw
  28104. WWExist
  28105.  
  28106. æKY ACount
  28107. æFp Globals
  28108. æD ACount  = $A9A [GLOBAL VAR] Stage number (0 through 3) of last alert (word)
  28109.  
  28110. æKY ANumber
  28111. æFp Globals
  28112. æD ANumber  = $A98 [GLOBAL VAR] Resource ID of last alert (word)
  28113.  
  28114. æKY ApFontID
  28115. æFp Globals
  28116. æD ApFontID = $984 [GLOBAL VAR] Font number of application font (word)
  28117.  
  28118. æKY ApplScratch
  28119. æFp Globals
  28120. æD ApplScratch = $A78 [GLOBAL VAR] 12-byte scratch area reserved for use by applications
  28121.  
  28122. æKY AppParmHandle
  28123. æFp Globals
  28124. æD AppParmHandle = $AEC [GLOBAL VAR] Handle to Finder information
  28125.  
  28126. æKY DABeeper
  28127. æFp Globals
  28128. æD DABeeper = $A9C [GLOBAL VAR] Address of current sound procedure
  28129.  
  28130. æKY DAStrings
  28131. æFp Globals
  28132. æD DAStrings = $AA0 [GLOBAL VAR] Handles to ParamText strings (16 bytes) 
  28133.  
  28134. æKY DefVCBPtr
  28135. æFp Globals
  28136. æD DefVCBPtr = $352 [GLOBAL VAR] Pointer to default volume control block 
  28137.  
  28138. æKY DlgFont
  28139. æFp Globals
  28140. æD DlgFont  = $AFA [GLOBAL VAR] Font number for dialogs and alerts (word)
  28141.  
  28142. æKY DragPattern
  28143. æFp Globals
  28144. æD DragPattern = $A34 [GLOBAL VAR] Pattern of dragged region's outline (8 bytes)
  28145.  
  28146. æKY FCBSPtr
  28147. æFp Globals
  28148. æD FCBSPtr = $34E [GLOBAL VAR] Pointer to file-control-block buffer
  28149.  
  28150. æKY FinderName
  28151. æFp Globals
  28152. æD FinderName = $2E0 [GLOBAL VAR] Name of the Finder (length byte followed by up to 15 
  28153. characters)
  28154.  
  28155. æKY FScaleDisable
  28156. æFp Globals
  28157. æD FScaleDisable = $A63 [GLOBAL VAR] Nonzero to disable font scaling (byte)
  28158.  
  28159. æKY FSQHdr
  28160. æFp Globals
  28161. æD FSQHdr = $360 [GLOBAL VAR] File I/O queue header (10 bytes)
  28162.  
  28163. æKY MBarEnable
  28164. æFp Globals
  28165. æD MBarEnable = $A20 [GLOBAL VAR] Unique menu ID for active desk accessory, when menu bar 
  28166.                   belongs to the accessory (word) 
  28167.  
  28168. æKY MBarHook
  28169. æFp Globals
  28170. æD MBarHook = $A2C [GLOBAL VAR] Address of routine called by MenuSelect before menu is 
  28171.                 drawn
  28172.  
  28173. æKY MenuFlash
  28174. æFp Globals
  28175. æD MenuFlash = $A24 [GLOBAL VAR] Count for duration of menu item blinking (word)
  28176.  
  28177. æKY MenuHook
  28178. æFp Globals
  28179. æD MenuHook = $A30 [GLOBAL VAR] Address of routine called during MenuSelect
  28180.  
  28181. æKY MenuList
  28182. æFp Globals
  28183. æD MenuList = $A1C [GLOBAL VAR] Handle to current menu list
  28184.  
  28185. æKY OldContent
  28186. æFp Globals
  28187. æD OldContent = $9EA [GLOBAL VAR] Handle to saved content region
  28188.  
  28189. æKY OldStructure
  28190. æFp Globals
  28191. æD OldStructure = $9E6 [GLOBAL VAR] Handle to saved structure region
  28192.  
  28193. æKY PrintErr
  28194. æFp Globals
  28195. æD PrintErr = $944 [GLOBAL VAR] Result code from last Printing Manager routine (word)
  28196.  
  28197. æKY ROMFont0
  28198. æFp Globals
  28199. æD ROMFont0 = $980 [GLOBAL VAR] Handle to font record for system font
  28200.  
  28201. æKY SaveUpdate
  28202. æFp Globals
  28203. æD SaveUpdate = $9DA [GLOBAL VAR] Flag for whether to generate update events (word)
  28204.  
  28205. æKY SaveVisRgn
  28206. æFp Globals
  28207. æD SaveVisRgn = $9F2 [GLOBAL VAR] Handle to saved visRgn
  28208.  
  28209. æKY TheMenu
  28210. æFp Globals
  28211. æD TheMenu  = $A26 [GLOBAL VAR] Menu ID of currently highlighted menu (word)
  28212.  
  28213. æKY ToExtFS
  28214. æFp Globals
  28215. æD ToExtFS  = $3F2 [GLOBAL VAR] Pointer to external file system
  28216.  
  28217. æKY ToolScratch
  28218. æFp Globals
  28219. æD ToolScratch = $9CE [GLOBAL VAR] 8-byte scratch area
  28220.  
  28221. æKY VCBQHdr
  28222. æFp Globals
  28223. æD VCBQHdr  = $356 [GLOBAL VAR] Volume-control-block queue header (10 bytes)
  28224.  
  28225.  
  28226. æKY Graf3D.p
  28227. æKL Clip3D
  28228. GetPort3D
  28229. Identity
  28230. InitGrf3d
  28231. Line2D
  28232. Line3D
  28233. LineTo2D
  28234. LineTo3D
  28235. LookAt
  28236. Move2D
  28237. Move3D
  28238. MoveTo2D
  28239. MoveTo3D
  28240. Open3DPort
  28241. Pitch
  28242. Roll
  28243. Scale
  28244. SetPort3D
  28245. SetPt2D
  28246. SetPt3D
  28247. Skew
  28248. Transform
  28249. Translate
  28250. ViewAngle
  28251. ViewPort
  28252. Yaw
  28253.  
  28254. Point2D
  28255. Point3D
  28256. Port3D
  28257. Port3DHandle
  28258. Port3DPtr
  28259. radConst
  28260. XfMatrix
  28261.  
  28262. æKY radConst
  28263. æFp Graf3D.p
  28264. æT CONST
  28265. æD radConst = 3754936;
  28266. æC 
  28267.  
  28268. æKY Point3D
  28269. æFp Graf3D.p
  28270. æT RECORD
  28271. æD Point3D = RECORD
  28272.     x: Fixed;
  28273.     y: Fixed;
  28274.     z: Fixed;
  28275.     END;
  28276. æC 
  28277.  
  28278. æKY Point2D
  28279. æFp Graf3D.p
  28280. æT RECORD
  28281. æD Point2D = RECORD
  28282.     x: Fixed;
  28283.     y: Fixed;
  28284.     END;
  28285. æC 
  28286.  
  28287. æKY XfMatrix
  28288. æFp Graf3D.p
  28289. æT RECORD
  28290. æD XfMatrix = ARRAY [0..3, 0..3] OF Fixed;
  28291. æC 
  28292.  
  28293. æKY Port3D
  28294. Port3DPtr
  28295. Port3DHandle
  28296. æFp Graf3D.p
  28297. æT RECORD
  28298. æD Port3DPtr = ^Port3D;
  28299. Port3DHandle = ^Port3DPtr;
  28300. Port3D = RECORD
  28301.     grPort: GrafPtr;
  28302.     viewRect: Rect;
  28303.     xLeft: Fixed;
  28304.     yTop: Fixed;
  28305.     xRight: Fixed;
  28306.     yBottom: Fixed;
  28307.     pen: Point3D;
  28308.     penPrime: Point3D;
  28309.     eye: Point3D;
  28310.     hSize: Fixed;
  28311.     vSize: Fixed;
  28312.     hCenter: Fixed;
  28313.     vCenter: Fixed;
  28314.     xCotan: Fixed;
  28315.     yCotan: Fixed;
  28316.     ident: BOOLEAN;
  28317.     xForm: XfMatrix;
  28318.     END;
  28319. æC 
  28320.  
  28321. æKY InitGrf3d
  28322. æFp Graf3D.p
  28323. æT PROCEDURE
  28324. æD PROCEDURE InitGrf3d(port: Port3DHandle);
  28325. æDT InitGrf3d(port);
  28326. æC 
  28327.  
  28328. æKY Open3DPort
  28329. æFp Graf3D.p
  28330. æT PROCEDURE
  28331. æD PROCEDURE Open3DPort(port: Port3DPtr);
  28332. æDT Open3DPort(port);
  28333. æC 
  28334.  
  28335. æKY SetPort3D
  28336. æFp Graf3D.p
  28337. æT PROCEDURE
  28338. æD PROCEDURE SetPort3D(port: Port3DPtr);
  28339. æDT SetPort3D(port);
  28340. æC     SetPort sets the grafPort indicated by gp to be the current port.
  28341. The global pointer thePort always points to the current port. All
  28342. QuickDraw drawing routines affect the bitMap thePort^.portBits and use
  28343. the local coordinate system of thePort^. Note that OpenPort and
  28344. InitPort do a SetPort to the given port.
  28345.  
  28346. Warning:
  28347.  
  28348.     Never do a SetPort to a port that has not been opened
  28349.     with OpenPort.
  28350.  
  28351.     Each port possesses its own pen and text characteristics which
  28352. remain unchanged when the port is not selected as the current port.
  28353.  
  28354. æKY GetPort3D
  28355. æFp Graf3D.p
  28356. æT PROCEDURE
  28357. æD PROCEDURE GetPort3D(VAR port: Port3DPtr);
  28358. æDT GetPort3D(port);
  28359. æC     GetPort returns a pointer to the current grafPort. If you have a
  28360. program that draws into more than one grafPort, it's extremely useful 
  28361. to have each procedure save the current grafPort (with GetPort), set
  28362. its own grafPort, do drawing or calculations, and then restore the
  28363. previous grafPort (with SetPort). The pointer to the current grafPort
  28364. is also available through the global pointer thePort, but you may
  28365. prefer to use GetPort for better readability of your program text. For
  28366. example, a procedure could do a GetPort (savePort) before setting its
  28367. own grafPort and a SetPort (savePort) afterwards to restore the
  28368. previous port.
  28369.  
  28370. æKY MoveTo2D
  28371. æFp Graf3D.p
  28372. æT PROCEDURE
  28373. æD PROCEDURE MoveTo2D(x: Fixed;y: Fixed);
  28374. æDT MoveTo2D(x,y);
  28375. æC     MoveTo moves the pen to location  (h,v) in the local coordinates of
  28376. the current grafPort. No drawing is performed.
  28377.  
  28378. æKY MoveTo3D
  28379. æFp Graf3D.p
  28380. æT PROCEDURE
  28381. æD PROCEDURE MoveTo3D(x: Fixed;y: Fixed;z: Fixed);
  28382. æDT MoveTo3D(x,y,z);
  28383. æC 
  28384.  
  28385. æKY LineTo2D
  28386. æFp Graf3D.p
  28387. æT PROCEDURE
  28388. æD PROCEDURE LineTo2D(x: Fixed;y: Fixed);
  28389. æDT LineTo2D(x,y);
  28390. æC     This procedure draws a line to the location that is a distance of dh
  28391. horizontally and dv vertically from the current pen location; it calls
  28392. LineTo(h+dh,v+dv), where (h,v) is the current location. The positive
  28393. directions are to the right and down. The pen location becomes the
  28394. coordinates of the end of the line after the line is drawn. See the
  28395. general discussion of drawing.
  28396.  
  28397.     If a region or polygon is open and being formed, its outline is
  28398. infinitely thin and is not affected by the pnSize, pnMode, or pnPat.
  28399. (See OpenRgn and OpenPoly.)
  28400.  
  28401. æKY Move2D
  28402. æFp Graf3D.p
  28403. æT PROCEDURE
  28404. æD PROCEDURE Move2D(dx: Fixed;dy: Fixed);
  28405. æDT Move2D(dx,dy);
  28406. æC 
  28407.  
  28408. æKY Move3D
  28409. æFp Graf3D.p
  28410. æT PROCEDURE
  28411. æD PROCEDURE Move3D(dx: Fixed;dy: Fixed;dz: Fixed);
  28412. æDT Move3D(dx,dy,dz);
  28413. æC 
  28414.  
  28415. æKY Line2D
  28416. æFp Graf3D.p
  28417. æT PROCEDURE
  28418. æD PROCEDURE Line2D(dx: Fixed;dy: Fixed);
  28419. æDT Line2D(dx,dy);
  28420. æC 
  28421.  
  28422. æKY Line3D
  28423. æFp Graf3D.p
  28424. æT PROCEDURE
  28425. æD PROCEDURE Line3D(dx: Fixed;dy: Fixed;dz: Fixed);
  28426. æDT Line3D(dx,dy,dz);
  28427. æC 
  28428.  
  28429. æKY ViewPort
  28430. æFp Graf3D.p
  28431. æT PROCEDURE
  28432. æD PROCEDURE ViewPort(r: Rect);
  28433. æDT ViewPort(r);
  28434. æC 
  28435.  
  28436. æKY LookAt
  28437. æFp Graf3D.p
  28438. æT PROCEDURE
  28439. æD PROCEDURE LookAt(left: Fixed;top: Fixed;right: Fixed;bottom: Fixed);
  28440. æDT LookAt(left,top,right,bottom);
  28441. æC 
  28442.  
  28443. æKY ViewAngle
  28444. æFp Graf3D.p
  28445. æT PROCEDURE
  28446. æD PROCEDURE ViewAngle(angle: Fixed);
  28447. æDT ViewAngle(angle);
  28448. æC 
  28449.  
  28450. æKY Identity
  28451. æFp Graf3D.p
  28452. æT PROCEDURE
  28453. æD PROCEDURE Identity;
  28454. æDT Identity(paramList);
  28455. æC 
  28456.  
  28457. æKY Scale
  28458. æFp Graf3D.p
  28459. æT PROCEDURE
  28460. æD PROCEDURE Scale(xFactor: Fixed;yFactor: Fixed;zFactor: Fixed);
  28461. æDT Scale(xFactor,yFactor,zFactor);
  28462. æC 
  28463.  
  28464. æKY Translate
  28465. æFp Graf3D.p
  28466. æT PROCEDURE
  28467. æD PROCEDURE Translate(dx: Fixed;dy: Fixed;dz: Fixed);
  28468. æDT Translate(dx,dy,dz);
  28469. æC 
  28470.  
  28471. æKY Pitch
  28472. æFp Graf3D.p
  28473. æT PROCEDURE
  28474. æD PROCEDURE Pitch(xAngle: Fixed);
  28475. æDT Pitch(xAngle);
  28476. æC 
  28477.  
  28478. æKY Yaw
  28479. æFp Graf3D.p
  28480. æT PROCEDURE
  28481. æD PROCEDURE Yaw(yAngle: Fixed);
  28482. æDT Yaw(yAngle);
  28483. æC 
  28484.  
  28485. æKY Roll
  28486. æFp Graf3D.p
  28487. æT PROCEDURE
  28488. æD PROCEDURE Roll(zAngle: Fixed);
  28489. æDT Roll(zAngle);
  28490. æC 
  28491.  
  28492. æKY Skew
  28493. æFp Graf3D.p
  28494. æT PROCEDURE
  28495. æD PROCEDURE Skew(zAngle: Fixed);
  28496. æDT Skew(zAngle);
  28497. æC 
  28498.  
  28499. æKY Transform
  28500. æFp Graf3D.p
  28501. æT PROCEDURE
  28502. æD PROCEDURE Transform(src: Point3D;VAR dst: Point3D);
  28503. æDT Transform(src,dst);
  28504. æC 
  28505.  
  28506. æKY Clip3D
  28507. æFp Graf3D.p
  28508. æT FUNCTION
  28509. æD FUNCTION Clip3D(src1: Point3D;src2: Point3D;VAR dst1: Point;VAR dst2: Point): INTEGER;
  28510. æDT myVariable := Clip3D(src1,src2,dst1,dst2);
  28511. æC 
  28512.  
  28513. æKY SetPt3D
  28514. æFp Graf3D.p
  28515. æT PROCEDURE
  28516. æD PROCEDURE SetPt3D(VAR pt3D: Point3D;x: Fixed;y: Fixed;z: Fixed);
  28517. æDT SetPt3D(pt3D,x,y,z);
  28518. æC     SetPt assigns two integer coordinates to a variable of type Point.
  28519.  
  28520. æKY SetPt2D
  28521. æFp Graf3D.p
  28522. æT PROCEDURE
  28523. æD PROCEDURE SetPt2D(VAR pt2D: Point2D;x: Fixed;y: Fixed);
  28524. æDT SetPt2D(pt2D,x,y);
  28525. æC 
  28526.  
  28527. æKY LineTo3D
  28528. æFp Graf3D.p
  28529. æT PROCEDURE
  28530. æD PROCEDURE LineTo3D(x: Fixed;y: Fixed;z: Fixed);
  28531. æDT LineTo3D(x,y,z);
  28532. æC 
  28533.  
  28534.  
  28535. æKY HyperXCmd.p
  28536. æKL BoolToStr
  28537. EvalExpr
  28538. ExtToStr
  28539. GetFieldByID
  28540. GetFieldByName
  28541. GetFieldByNum
  28542. GetGlobal
  28543. LongToStr
  28544. NumToHex
  28545. NumToStr
  28546. PasToZero
  28547. ReturnToPas
  28548. ScanToReturn
  28549. ScanToZero
  28550. SendCardMessage
  28551. SendHCMessage
  28552. SetFieldByID
  28553. SetFieldByName
  28554. SetFieldByNum
  28555. SetGlobal
  28556. StringEqual
  28557. StringLength
  28558. StringMatch
  28559. StrToBool
  28560. StrToExt
  28561. StrToLong
  28562. StrToNum
  28563. ZeroBytes
  28564. ZeroToPas
  28565.  
  28566. XCmdBlock
  28567. XCmdPtr
  28568. xreqBoolToStr
  28569. xreqEvalExpr
  28570. xreqExtToStr
  28571. xreqGetFieldByID
  28572. xreqGetFieldByName
  28573. xreqGetFieldByNum
  28574. xreqGetGlobal
  28575. xreqLongToStr
  28576. xreqNumToHex
  28577. xreqNumToStr
  28578. xreqPasToZero
  28579. xreqReturnToPas
  28580. xreqScanToReturn
  28581. xreqScanToZero
  28582. xreqSendCardMessage
  28583. xreqSendHCMessage
  28584. xreqSetFieldByID
  28585. xreqSetFieldByName
  28586. xreqSetFieldByNum
  28587. xreqSetGlobal
  28588. xreqStringEqual
  28589. xreqStringLength
  28590. xreqStringMatch
  28591. xreqStrToBool
  28592. xreqStrToExt
  28593. xreqStrToLong
  28594. xreqStrToNum
  28595. xreqZeroBytes
  28596. xreqZeroToPas
  28597. xresFail
  28598. xresNotImp
  28599. xresSucc
  28600.  
  28601. æKY xresSucc
  28602. æFp HyperXCmd.p
  28603. æT CONST
  28604. æD 
  28605. { result codes }
  28606.  
  28607. xresSucc = 0;
  28608. æC 
  28609.  
  28610. æKY xresFail
  28611. æFp HyperXCmd.p
  28612. æT CONST
  28613. æD xresFail = 1;
  28614. æC 
  28615.  
  28616. æKY xresNotImp
  28617. æFp HyperXCmd.p
  28618. æT CONST
  28619. æD xresNotImp = 2;
  28620. æC 
  28621.  
  28622. æKY xreqSendCardMessage
  28623. æFp HyperXCmd.p
  28624. æT CONST
  28625. æD 
  28626. { request codes }
  28627.  
  28628. xreqSendCardMessage = 1;
  28629. æC 
  28630.  
  28631. æKY xreqEvalExpr
  28632. æFp HyperXCmd.p
  28633. æT CONST
  28634. æD xreqEvalExpr = 2;
  28635. æC 
  28636.  
  28637. æKY xreqStringLength
  28638. æFp HyperXCmd.p
  28639. æT CONST
  28640. æD xreqStringLength = 3;
  28641. æC 
  28642.  
  28643. æKY xreqStringMatch
  28644. æFp HyperXCmd.p
  28645. æT CONST
  28646. æD xreqStringMatch = 4;
  28647. æC 
  28648.  
  28649. æKY xreqSendHCMessage
  28650. æFp HyperXCmd.p
  28651. æT CONST
  28652. æD xreqSendHCMessage = 5;
  28653. æC 
  28654.  
  28655. æKY xreqZeroBytes
  28656. æFp HyperXCmd.p
  28657. æT CONST
  28658. æD xreqZeroBytes = 6;
  28659. æC 
  28660.  
  28661. æKY xreqPasToZero
  28662. æFp HyperXCmd.p
  28663. æT CONST
  28664. æD xreqPasToZero = 7;
  28665. æC 
  28666.  
  28667. æKY xreqZeroToPas
  28668. æFp HyperXCmd.p
  28669. æT CONST
  28670. æD xreqZeroToPas = 8;
  28671. æC 
  28672.  
  28673. æKY xreqStrToLong
  28674. æFp HyperXCmd.p
  28675. æT CONST
  28676. æD xreqStrToLong = 9;
  28677. æC 
  28678.  
  28679. æKY xreqStrToNum
  28680. æFp HyperXCmd.p
  28681. æT CONST
  28682. æD xreqStrToNum = 10;
  28683. æC 
  28684.  
  28685. æKY xreqStrToBool
  28686. æFp HyperXCmd.p
  28687. æT CONST
  28688. æD xreqStrToBool = 11;
  28689. æC 
  28690.  
  28691. æKY xreqStrToExt
  28692. æFp HyperXCmd.p
  28693. æT CONST
  28694. æD xreqStrToExt = 12;
  28695. æC 
  28696.  
  28697. æKY xreqLongToStr
  28698. æFp HyperXCmd.p
  28699. æT CONST
  28700. æD xreqLongToStr = 13;
  28701. æC 
  28702.  
  28703. æKY xreqNumToStr
  28704. æFp HyperXCmd.p
  28705. æT CONST
  28706. æD xreqNumToStr = 14;
  28707. æC 
  28708.  
  28709. æKY xreqNumToHex
  28710. æFp HyperXCmd.p
  28711. æT CONST
  28712. æD xreqNumToHex = 15;
  28713. æC 
  28714.  
  28715. æKY xreqBoolToStr
  28716. æFp HyperXCmd.p
  28717. æT CONST
  28718. æD xreqBoolToStr = 16;
  28719. æC 
  28720.  
  28721. æKY xreqExtToStr
  28722. æFp HyperXCmd.p
  28723. æT CONST
  28724. æD xreqExtToStr = 17;
  28725. æC 
  28726.  
  28727. æKY xreqGetGlobal
  28728. æFp HyperXCmd.p
  28729. æT CONST
  28730. æD xreqGetGlobal = 18;
  28731. æC 
  28732.  
  28733. æKY xreqSetGlobal
  28734. æFp HyperXCmd.p
  28735. æT CONST
  28736. æD xreqSetGlobal = 19;
  28737. æC 
  28738.  
  28739. æKY xreqGetFieldByName
  28740. æFp HyperXCmd.p
  28741. æT CONST
  28742. æD xreqGetFieldByName = 20;
  28743. æC 
  28744.  
  28745. æKY xreqGetFieldByNum
  28746. æFp HyperXCmd.p
  28747. æT CONST
  28748. æD xreqGetFieldByNum = 21;
  28749. æC 
  28750.  
  28751. æKY xreqGetFieldByID
  28752. æFp HyperXCmd.p
  28753. æT CONST
  28754. æD xreqGetFieldByID = 22;
  28755. æC 
  28756.  
  28757. æKY xreqSetFieldByName
  28758. æFp HyperXCmd.p
  28759. æT CONST
  28760. æD xreqSetFieldByName = 23;
  28761. æC 
  28762.  
  28763. æKY xreqSetFieldByNum
  28764. æFp HyperXCmd.p
  28765. æT CONST
  28766. æD xreqSetFieldByNum = 24;
  28767. æC 
  28768.  
  28769. æKY xreqSetFieldByID
  28770. æFp HyperXCmd.p
  28771. æT CONST
  28772. æD xreqSetFieldByID = 25;
  28773. æC 
  28774.  
  28775. æKY xreqStringEqual
  28776. æFp HyperXCmd.p
  28777. æT CONST
  28778. æD xreqStringEqual = 26;
  28779. æC 
  28780.  
  28781. æKY xreqReturnToPas
  28782. æFp HyperXCmd.p
  28783. æT CONST
  28784. æD xreqReturnToPas = 27;
  28785. æC 
  28786.  
  28787. æKY xreqScanToReturn
  28788. æFp HyperXCmd.p
  28789. æT CONST
  28790. æD xreqScanToReturn = 28;
  28791. æC 
  28792.  
  28793. æKY xreqScanToZero
  28794. æFp HyperXCmd.p
  28795. æT CONST
  28796. æD xreqScanToZero = 39; { Yes, really 39!}
  28797. æC 
  28798.  
  28799. æKY XCmdBlock
  28800. XCmdPtr
  28801. æFp HyperXCmd.p
  28802. æT RECORD
  28803. æD XCmdPtr = ^XCmdBlock;
  28804. XCmdBlock = RECORD
  28805.     paramCount: INTEGER;
  28806.     params: ARRAY [1..16] OF Handle;
  28807.     returnValue: Handle;
  28808.     passFlag: BOOLEAN;
  28809.     entryPoint: ProcPtr; {to call back to HyperCard}
  28810.     request: INTEGER;
  28811.     result: INTEGER;
  28812.     inArgs: ARRAY [1..8] OF LONGINT;
  28813.     outArgs: ARRAY [1..4] OF LONGINT;
  28814.     END;
  28815. æC 
  28816.  
  28817. æKY SendCardMessage
  28818. æFp HyperXCmd.p
  28819. æT PROCEDURE
  28820. æD PROCEDURE SendCardMessage(paramPtr: XCmdPtr;msg: Str255);
  28821. {  Message sending  }
  28822. æDT SendCardMessage(paramPtr,msg);
  28823. æC 
  28824.  
  28825. æKY SendHCMessage
  28826. æFp HyperXCmd.p
  28827. æT PROCEDURE
  28828. æD PROCEDURE SendHCMessage(paramPtr: XCmdPtr;msg: Str255);
  28829. æDT SendHCMessage(paramPtr,msg);
  28830. æC 
  28831.  
  28832. æKY GetGlobal
  28833. æFp HyperXCmd.p
  28834. æT FUNCTION
  28835. æD FUNCTION GetGlobal(paramPtr: XCmdPtr;globName: Str255): Handle;
  28836. {  Container access  }
  28837. æDT myVariable := GetGlobal(paramPtr,globName);
  28838. æC 
  28839.  
  28840. æKY SetGlobal
  28841. æFp HyperXCmd.p
  28842. æT PROCEDURE
  28843. æD PROCEDURE SetGlobal(paramPtr: XCmdPtr;globName: Str255;globValue: Handle);
  28844. æDT SetGlobal(paramPtr,globName,globValue);
  28845. æC 
  28846.  
  28847. æKY GetFieldByID
  28848. æFp HyperXCmd.p
  28849. æT FUNCTION
  28850. æD FUNCTION GetFieldByID(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldID: INTEGER): Handle;
  28851. æDT myVariable := GetFieldByID(paramPtr,cardFieldFlag,fieldID);
  28852. æC 
  28853.  
  28854. æKY GetFieldByName
  28855. æFp HyperXCmd.p
  28856. æT FUNCTION
  28857. æD FUNCTION GetFieldByName(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldName: Str255): Handle;
  28858. æDT myVariable := GetFieldByName(paramPtr,cardFieldFlag,fieldName);
  28859. æC 
  28860.  
  28861. æKY GetFieldByNum
  28862. æFp HyperXCmd.p
  28863. æT FUNCTION
  28864. æD FUNCTION GetFieldByNum(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldNum: INTEGER): Handle;
  28865. æDT myVariable := GetFieldByNum(paramPtr,cardFieldFlag,fieldNum);
  28866. æC 
  28867.  
  28868. æKY SetFieldByID
  28869. æFp HyperXCmd.p
  28870. æT PROCEDURE
  28871. æD PROCEDURE SetFieldByID(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldID: INTEGER;
  28872.     fieldVal: Handle);
  28873. æDT SetFieldByID(paramPtr,cardFieldFlag,fieldID,fieldVal);
  28874. æC 
  28875.  
  28876. æKY SetFieldByName
  28877. æFp HyperXCmd.p
  28878. æT PROCEDURE
  28879. æD PROCEDURE SetFieldByName(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldName: Str255;
  28880.     fieldVal: Handle);
  28881. æDT SetFieldByName(paramPtr,cardFieldFlag,fieldName,fieldVal);
  28882. æC 
  28883.  
  28884. æKY SetFieldByNum
  28885. æFp HyperXCmd.p
  28886. æT PROCEDURE
  28887. æD PROCEDURE SetFieldByNum(paramPtr: XCmdPtr;cardFieldFlag: BOOLEAN;fieldNum: INTEGER;
  28888.     fieldVal: Handle);
  28889. æDT SetFieldByNum(paramPtr,cardFieldFlag,fieldNum,fieldVal);
  28890. æC 
  28891.  
  28892. æKY BoolToStr
  28893. æFp HyperXCmd.p
  28894. æT PROCEDURE
  28895. æD PROCEDURE BoolToStr(paramPtr: XCmdPtr;bool: BOOLEAN;VAR str: Str255);
  28896. {  String conversion  }
  28897. æDT BoolToStr(paramPtr,bool,str);
  28898. æC 
  28899.  
  28900. æKY ExtToStr
  28901. æFp HyperXCmd.p
  28902. æT PROCEDURE
  28903. æD PROCEDURE ExtToStr(paramPtr: XCmdPtr;num: extended;VAR str: Str255);
  28904. æDT ExtToStr(paramPtr,num,str);
  28905. æC 
  28906.  
  28907. æKY LongToStr
  28908. æFp HyperXCmd.p
  28909. æT PROCEDURE
  28910. æD PROCEDURE LongToStr(paramPtr: XCmdPtr;posNum: LONGINT;VAR str: Str255);
  28911. æDT LongToStr(paramPtr,posNum,str);
  28912. æC 
  28913.  
  28914. æKY NumToStr
  28915. æFp HyperXCmd.p
  28916. æT PROCEDURE
  28917. æD PROCEDURE NumToStr(paramPtr: XCmdPtr;num: LONGINT;VAR str: Str255);
  28918. æDT NumToStr(paramPtr,num,str);
  28919. æC 
  28920.  
  28921. æKY NumToHex
  28922. æFp HyperXCmd.p
  28923. æT PROCEDURE
  28924. æD PROCEDURE NumToHex(paramPtr: XCmdPtr;num: LONGINT;nDigits: INTEGER;VAR str: Str255);
  28925. æDT NumToHex(paramPtr,num,nDigits,str);
  28926. æC 
  28927.  
  28928. æKY StrToBool
  28929. æFp HyperXCmd.p
  28930. æT FUNCTION
  28931. æD FUNCTION StrToBool(paramPtr: XCmdPtr;str: Str255): BOOLEAN;
  28932. æDT myVariable := StrToBool(paramPtr,str);
  28933. æC 
  28934.  
  28935. æKY StrToExt
  28936. æFp HyperXCmd.p
  28937. æT FUNCTION
  28938. æD FUNCTION StrToExt(paramPtr: XCmdPtr;str: Str255): extended;
  28939. æDT myVariable := StrToExt(paramPtr,str);
  28940. æC 
  28941.  
  28942. æKY StrToLong
  28943. æFp HyperXCmd.p
  28944. æT FUNCTION
  28945. æD FUNCTION StrToLong(paramPtr: XCmdPtr;str: Str255): LONGINT;
  28946. æDT myVariable := StrToLong(paramPtr,str);
  28947. æC 
  28948.  
  28949. æKY StrToNum
  28950. æFp HyperXCmd.p
  28951. æT FUNCTION
  28952. æD FUNCTION StrToNum(paramPtr: XCmdPtr;str: Str255): LONGINT;
  28953. æDT myVariable := StrToNum(paramPtr,str);
  28954. æC 
  28955.  
  28956. æKY PasToZero
  28957. æFp HyperXCmd.p
  28958. æT FUNCTION
  28959. æD FUNCTION PasToZero(paramPtr: XCmdPtr;str: Str255): Handle;
  28960. æDT myVariable := PasToZero(paramPtr,str);
  28961. æC 
  28962.  
  28963. æKY ZeroToPas
  28964. æFp HyperXCmd.p
  28965. æT PROCEDURE
  28966. æD PROCEDURE ZeroToPas(paramPtr: XCmdPtr;zeroStr: Ptr;VAR pasStr: Str255);
  28967. æDT ZeroToPas(paramPtr,zeroStr,pasStr);
  28968. æC 
  28969.  
  28970. æKY EvalExpr
  28971. æFp HyperXCmd.p
  28972. æT FUNCTION
  28973. æD FUNCTION EvalExpr(paramPtr: XCmdPtr;expr: Str255): Handle;
  28974. {  Miscellaneous  }
  28975. æDT myVariable := EvalExpr(paramPtr,expr);
  28976. æC 
  28977.  
  28978. æKY ReturnToPas
  28979. æFp HyperXCmd.p
  28980. æT PROCEDURE
  28981. æD PROCEDURE ReturnToPas(paramPtr: XCmdPtr;zeroStr: Ptr;VAR pasStr: Str255);
  28982. æDT ReturnToPas(paramPtr,zeroStr,pasStr);
  28983. æC 
  28984.  
  28985. æKY ScanToReturn
  28986. æFp HyperXCmd.p
  28987. æT PROCEDURE
  28988. æD PROCEDURE ScanToReturn(paramPtr: XCmdPtr;VAR scanPtr: Ptr);
  28989. æDT ScanToReturn(paramPtr,scanPtr);
  28990. æC 
  28991.  
  28992. æKY ScanToZero
  28993. æFp HyperXCmd.p
  28994. æT PROCEDURE
  28995. æD PROCEDURE ScanToZero(paramPtr: XCmdPtr;VAR scanPtr: Ptr);
  28996. æDT ScanToZero(paramPtr,scanPtr);
  28997. æC 
  28998.  
  28999. æKY StringEqual
  29000. æFp HyperXCmd.p
  29001. æT FUNCTION
  29002. æD FUNCTION StringEqual(paramPtr: XCmdPtr;str1: Str255;str2: Str255): BOOLEAN;
  29003. æDT myVariable := StringEqual(paramPtr,str1,str2);
  29004. æC 
  29005.  
  29006. æKY StringMatch
  29007. æFp HyperXCmd.p
  29008. æT FUNCTION
  29009. æD FUNCTION StringMatch(paramPtr: XCmdPtr;pattern: Str255;target: Ptr): Ptr;
  29010. æDT myVariable := StringMatch(paramPtr,pattern,target);
  29011. æC 
  29012.  
  29013. æKY StringLength
  29014. æFp HyperXCmd.p
  29015. æT FUNCTION
  29016. æD FUNCTION StringLength(paramPtr: XCmdPtr;strPtr: Ptr): LONGINT;
  29017. æDT myVariable := StringLength(paramPtr,strPtr);
  29018. æC 
  29019.  
  29020. æKY ZeroBytes
  29021. æFp HyperXCmd.p
  29022. æT PROCEDURE
  29023. æD PROCEDURE ZeroBytes(paramPtr: XCmdPtr;dstPtr: Ptr;longCount: LONGINT);
  29024. æDT ZeroBytes(paramPtr,dstPtr,longCount);
  29025. æC 
  29026.  
  29027.  
  29028. æKY Lists.p
  29029. æKL LActivate
  29030. LAddColumn
  29031. LAddRow
  29032. LAddToCell
  29033. LAutoScroll
  29034. LCellSize
  29035. LClick
  29036. LClrCell
  29037. LDelColumn
  29038. LDelRow
  29039. LDispose
  29040. LDoDraw
  29041. LDraw
  29042. LFind
  29043. LGetCell
  29044. LGetSelect
  29045. LLastClick
  29046. LNew
  29047. LNextCell
  29048. LRect
  29049. LScroll
  29050. LSearch
  29051. LSetCell
  29052. LSetSelect
  29053. LSize
  29054. LUpdate
  29055.  
  29056. Cell
  29057. DataArray
  29058. DataHandle
  29059. DataPtr
  29060. lCloseMsg
  29061. lDoHAutoscroll
  29062. lDoVAutoscroll
  29063. lDrawMsg
  29064. lExtendDrag
  29065. lHiliteMsg
  29066. lInitMsg
  29067. ListHandle
  29068. ListPtr
  29069. ListRec
  29070. lNoDisjoint
  29071. lNoExtend
  29072. lNoNilHilite
  29073. lNoRect
  29074. lOnlyOne
  29075. lUseSense
  29076.  
  29077. æKY lDoVAutoscroll
  29078. æFp Lists.p
  29079. æT CONST
  29080. æD lDoVAutoscroll = 2;
  29081. æC 
  29082.  
  29083. æKY lDoHAutoscroll
  29084. æFp Lists.p
  29085. æT CONST
  29086. æD lDoHAutoscroll = 1;
  29087. æC 
  29088.  
  29089. æKY lOnlyOne
  29090. æFp Lists.p
  29091. æT CONST
  29092. æD lOnlyOne = -128;
  29093. æC 
  29094.  
  29095. æKY lExtendDrag
  29096. æFp Lists.p
  29097. æT CONST
  29098. æD lExtendDrag = 64;
  29099. æC 
  29100.  
  29101. æKY lNoDisjoint
  29102. æFp Lists.p
  29103. æT CONST
  29104. æD lNoDisjoint = 32;
  29105. æC 
  29106.  
  29107. æKY lNoExtend
  29108. æFp Lists.p
  29109. æT CONST
  29110. æD lNoExtend = 16;
  29111. æC 
  29112.  
  29113. æKY lNoRect
  29114. æFp Lists.p
  29115. æT CONST
  29116. æD lNoRect = 8;
  29117. æC 
  29118.  
  29119. æKY lUseSense
  29120. æFp Lists.p
  29121. æT CONST
  29122. æD lUseSense = 4;
  29123. æC 
  29124.  
  29125. æKY lNoNilHilite
  29126. æFp Lists.p
  29127. æT CONST
  29128. æD lNoNilHilite = 2;
  29129. æC 
  29130.  
  29131. æKY lInitMsg
  29132. æFp Lists.p
  29133. æT CONST
  29134. æD lInitMsg = 0;
  29135. æC 
  29136.  
  29137. æKY lDrawMsg
  29138. æFp Lists.p
  29139. æT CONST
  29140. æD lDrawMsg = 1;
  29141. æC 
  29142.  
  29143. æKY lHiliteMsg
  29144. æFp Lists.p
  29145. æT CONST
  29146. æD lHiliteMsg = 2;
  29147. æC 
  29148.  
  29149. æKY lCloseMsg
  29150. æFp Lists.p
  29151. æT CONST
  29152. æD lCloseMsg = 3;
  29153. æC 
  29154.  
  29155. æKY Cell
  29156. æFp Lists.p
  29157. æT RECORD
  29158. æD Cell = Point;
  29159. æC 
  29160.  
  29161. æKY ListRec
  29162. ListPtr
  29163. ListHandle
  29164. æFp Lists.p
  29165. æT RECORD
  29166. æD ListPtr = ^ListRec;
  29167. ListHandle = ^ListPtr;
  29168. ListRec = RECORD
  29169.     rView: Rect;
  29170.     port: GrafPtr;
  29171.     indent: Point;
  29172.     cellSize: Point;
  29173.     visible: Rect;
  29174.     vScroll: ControlHandle;
  29175.     hScroll: ControlHandle;
  29176.     selFlags: SignedByte;
  29177.     lActive: BOOLEAN;
  29178.     lReserved: SignedByte;
  29179.     listFlags: SignedByte;
  29180.     clikTime: LONGINT;
  29181.     clikLoc: Point;
  29182.     mouseLoc: Point;
  29183.     lClikLoop: ProcPtr;
  29184.     lastClick: Cell;
  29185.     refCon: LONGINT;
  29186.     listDefProc: Handle;
  29187.     userHandle: Handle;
  29188.     dataBounds: Rect;
  29189.     cells: DataHandle;
  29190.     maxIndex: INTEGER;
  29191.     cellArray: PACKED ARRAY [1..1] OF INTEGER;
  29192.     END;
  29193. æC 
  29194. »The List Record Data Structure
  29195.  
  29196. The exact data structure of a list record is as follows:
  29197.  
  29198. TYPE  Cell       = Point;
  29199.       DataArray  = PACKED ARRAY [0..32000] OF CHAR;
  29200.       DataPtr    = ^DataArray;
  29201.       DataHandle = ^DataPtr;
  29202.       ListRec    = RECORD
  29203.                      rView:        Rect;           {list's display rectangle}
  29204.                      port:         GrafPtr;        {list's grafPort}
  29205.                      indent:       Point;          {indent distance}
  29206.                      cellSize:     Point;          {cell size}
  29207.                      visible:      Rect;           {boundary of visible cells}
  29208.                      vScroll:      ControlHandle;  {vertical scroll bar}
  29209.                      hScroll:      ControlHandle;  {horizontal scroll bar}
  29210.                      selFlags:     SignedByte;     {selection flags}
  29211.                      lActive:      BOOLEAN;        {TRUE if active}
  29212.                      lReserved:    SignedByte;     {reserved}
  29213.                      listFlags:    SignedByte;     {automatic scrolling flags}
  29214.                      clikTime:     LONGINT;        {time of last click}
  29215.                      clikLoc:      Point;          {position of last click}
  29216.                      mouseLoc:     Point;          {current mouse location}
  29217.                      lClikLoop:    Ptr;            {routine for LClick}
  29218.                      lastClick:    Cell;           {last cell clicked}
  29219.                      refCon:       LONGINT;        {list's reference value}
  29220.                      listDefProc:  Handle;         {list definition procedure}
  29221.                      userHandle:   Handle;         {additional storage}
  29222.                      dataBounds:   Rect;           {boundary of cells allocated}
  29223.                      cells:        DataHandle;     {cell data}
  29224.                      maxIndex:     INTEGER;        {used internally}
  29225.                      cellArray:    ARRAY [1..1] OF INTEGER    {offsets to data}
  29226.                    END;
  29227.  
  29228.       ListPtr    = ^ListRec;
  29229.       ListHandle = ^ListPtr;
  29230.  
  29231. RView is the rectangle, given in the local coordinates of the grafPort, in which the
  29232. list is displayed. Room for scroll bars is not included in this rectangle. If the
  29233. list has scroll bars and is to fill the entire window, rView should be 15 points
  29234. smaller in each dimension than the grafPort.
  29235.  
  29236. Port is the grafPort used by the list; it’s set to the port of the window specified
  29237. when the list is created. Indent is the distance in pixels that the list definition
  29238. procedure should indent from the topLeft of the cell when drawing the contents. The
  29239. default value for indent is 0, but it can be set by the list definition procedure.
  29240.  
  29241. CellSize is the size of a cell in pixels. If it’s not specified when the list is
  29242. created, a default cell size is set. CellSize.v is set to the ascent plus descent
  29243. plus leading of the port’s font, and cellSize.h is set to
  29244.  
  29245.   (rView.right – rView.left) DIV (dataBounds.right – dataBounds.left)
  29246.  
  29247. A cell is a box in which a list element is displayed. Cells are identified by their
  29248. column and row numbers. In Figure 1, for instance, the highlighted cell is in column
  29249. 1, row 2.
  29250.  
  29251. Cells are declared as points, using the Point data type simply as a way of specifying
  29252. the column and row number of a cell. Similarly, visible and dataBounds use the Rect
  29253. data type to specify a rectangular set of cells as two diagonally opposite cell
  29254. coordinates (rather than two diagonally opposite points in the local coordinates of a
  29255. grafPort).
  29256.  
  29257. DataBounds is the boundary of the cells currently allocated, specified by row and
  29258. column. The list in Figure 1 (assuming the entire list is visible) has seventeen rows
  29259. and five columns of cells. DataBounds for this list can be represented, using the
  29260. QuickDraw rectangle notation (left,top)(right,bottom), as (0,0)(5,17). Notice that
  29261. the column and row specified for the bottom right of dataBounds are 1 greater in each
  29262. dimension than the column and row number of the bottom right cell. Thus, you can test
  29263. to see if a cell is a valid cell within the boundary of a list using the statement:
  29264.  
  29265.   IF PtInRect(c,myList^^.dataBounds) THEN...
  29266.  
  29267. The visible rectangle reflects which cells are currently within the visible part of
  29268. the list; it’s calculated by the List Manager according to the values you specify for
  29269. rView, dataBounds, and cellSize when you create the list.
  29270. (Visible.topLeft is the row and column of the top left visible cell; visible.botRight
  29271. is 1 greater in both dimensions than the row and column of the bottom right visible
  29272. cell.) For example, if only four cells—row 2, column 0; row 2, column 1; row 3,
  29273. column 0; and row 3, column 1—are visible, the visible rectangle is (0,2)(2,4). You
  29274. can test to see if a cell is visible using the statement:
  29275.  
  29276.   IF PtInRect(c,myList^^.visible) THEN...
  29277.  
  29278. •••Refer to Figure 1.•••
  29279.  
  29280. Figure 1–A Sample List
  29281.  
  29282. SelFlags contains selection flags for the List Manager. It’s initialized to 0; with
  29283. this setting, the List Manager selects cells according to the Macintosh User Interface
  29284. Guidelines. The meaning of these flags is explained below in the section “Cell Selection
  29285. Algorithm”. The listFlags field contains automatic scrolling flags; the List Manager
  29286. sets these flags automatically when you specify scroll bars. There are predefined
  29287. constants that let you set or test the status of the corresponding bits:
  29288.  
  29289. CONST  lDoVAutoScroll = 2;    {set to allow automatic vertical scrolling}
  29290.        lDoHAutoScroll = 1;    {set to allow automatic horizontal scrolling}
  29291.  
  29292. ClikLoc is the position of the last mouse click in local coordinates; you can use it
  29293. in the list definition procedure to get the position within the cell. LClikLoop is a
  29294. pointer to the routine to be called during the LClick function, as described later.
  29295. LastClick contains the cell coordinates of the last cell clicked in.
  29296.  
  29297. RefCon is the list’s reference value field, which the application may store into and
  29298. access for any purpose. In addition, the application may use the field userHandle to
  29299. store a handle to an additional storage area.
  29300.  
  29301. CellArray contains offsets to the cell data. For each list element, this includes the
  29302. bit indicating whether the cell is selected or not.
  29303.  
  29304. »The LClikLoop Field
  29305.  
  29306. The lClikLoop field of a list record lets you specify a routine that will be called
  29307. repeatedly (by the LClick function, described below) as long as the mouse button is
  29308. held down within the rView rectangle or its scroll bars.
  29309.  
  29310. Note:  The LClick function performs automatic scrolling if the mouse is
  29311.        dragged outside the visible rectangle, so there’s no need to write
  29312.        a list click loop routine to do automatic scrolling.
  29313.  
  29314. The list click loop routine has no parameters and returns a Boolean value. You could
  29315. declare a list click loop routine named MyClikLoop like this:
  29316.  
  29317. FUNCTION MyClikLoop :  BOOLEAN;
  29318.  
  29319. The function should return TRUE. You must put a pointer to your list click loop
  29320. routine in the lClikLoop field of the list record so that the List Manager will call
  29321. your routine.
  29322.  
  29323. Warning:  Returning FALSE from your list click loop routine tells the
  29324.           LClick function that the mouse button has been released, which
  29325.           aborts LClick.
  29326.  
  29327. Assembly-language note:  Your routine should set register D0 to 1; returning
  29328.                          0 in register D0 aborts LClick. For your convenience,
  29329.                          register D5 contains the current mouse location.
  29330.  
  29331. æKY DataArray
  29332. DataPtr
  29333. DataHandle
  29334. æFp Lists.p
  29335. æT RECORD
  29336. æD DataPtr = ^DataArray;
  29337. DataHandle = ^DataPtr;
  29338.  
  29339. DataArray = PACKED ARRAY [0..32000] OF CHAR;
  29340. æC 
  29341.  
  29342. æKY LNew
  29343. æFp Lists.p
  29344. æT FUNCTION
  29345. æTN $A9E7
  29346. æD FUNCTION LNew(rView: Rect;dataBounds: Rect;cSize: Point;theProc: INTEGER;
  29347.     theWindow: WindowPtr;drawIt: BOOLEAN;hasGrow: BOOLEAN;scrollHoriz: BOOLEAN;
  29348.     scrollVert: BOOLEAN): ListHandle;
  29349.     INLINE $3F3C,$0044,$A9E7;
  29350. æDT myVariable := LNew(rView,dataBounds,cSize,theProc,theWindow,drawIt,hasGrow,scrollHoriz,scrollVert);
  29351. æRI IV-270
  29352. æC 
  29353. Call LNew to create a new list. It returns a handle to the new list. The list’s
  29354. grafPort is set to theWindow’s port. If drawIt is FALSE, the list is not displayed.
  29355.  
  29356. RView specifies, in the local coordinates of theWindow, the rectangle in which the
  29357. list will be displayed. (Remember that this doesn’t include space for scroll bars. If
  29358. the list, including scroll bars, is to fill the entire window, rView should be 15
  29359. points smaller in each dimension than theWindow’s portRect.)
  29360.  
  29361. DataBounds is the rectangle for specifying the initial array dimensions of the list.
  29362. For example to preallocate space for a list that’s 5 cells across by 10 cells down,
  29363. you should set dataBounds to (0,0)(5,10). If you want to allocate the space for a
  29364. one-column list, set dataBounds to (0,0)(1,0) and use LAddRow.
  29365.  
  29366. CSize.h and cSize.v are the desired height and width of each cell in pixels; if
  29367. they’re not specified, a default cell size is calculated (as described above).
  29368.  
  29369. TheProc is the resource ID of your list definition procedure; for a text-only list,
  29370. pass 0 and the default list definition procedure (about 150 bytes in size) will be
  29371. used. The list definition procedure is called to initialize itself after all other
  29372. list record fields have been initialized; thus, it can use any of the values in the
  29373. list record (or set particular fields, such as the indent distance).
  29374.  
  29375. If hasGrow is TRUE, the scroll bars are sized so that there’s room for a size box in
  29376. the standard position. It’s up to the program to display the size box
  29377. (using the Window Manager procedure DrawGrowIcon). If scrollHoriz is TRUE, a horizontal
  29378. scroll bar is placed immediately below rView and all horizontal scrolling functions
  29379. are implemented. If scrollVert is TRUE, a vertical scroll bar is placed immediately
  29380. to the right of rView and all vertical scrolling functions are implemented.
  29381.  
  29382. The visible rectangle is set to contain as many cells of cSize (or the default) as
  29383. will fit into rView. If the cells do not fit exactly into rView, the visible rectangle
  29384. is rounded up to the nearest cell. Scrolling will always allow all cells to be fully
  29385. displayed. The selection flags are set to 0, and the active flag is set to TRUE.
  29386.  
  29387. Note:  Scrolling looks best if rView is a multiple of cSize.v in height.
  29388.  
  29389. Assembly-language note:  You can invoke each of the List Manager routines
  29390.                          with a macro that has the same name as the routine
  29391.                          preceded by an underscore. These macros expand to
  29392.                          invoke to trap macro _Pack 0. The package determines
  29393.                          which routine to execute from a routine selector, an
  29394.                          integer that’s passed to it in a word on the stack.
  29395.                          The routine selectors are as follows:
  29396.  
  29397.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29398.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29399.                            lAddRow     .EQU    8    lClick       .EQU    24
  29400.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29401.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29402.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29403.                            lDispose    .EQU    40   lRect        .EQU    76
  29404.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29405.                            lDraw       .EQU    48   lSearch      .EQU    84
  29406.                            lFind       .EQU    52   lSetCell     .EQU    88
  29407.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29408.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29409.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29410.  
  29411. æKY LDispose
  29412. æFp Lists.p
  29413. æT PROCEDURE
  29414. æTN $A9E7
  29415. æD PROCEDURE LDispose(lHandle: ListHandle);
  29416.     INLINE $3F3C,$0028,$A9E7;
  29417. æDT LDispose(lHandle);
  29418. æRI IV-271
  29419. æC 
  29420. Call LDispose when you are through using a list. It issues a close call to the list
  29421. definition procedure, and calls the Memory Manager procedure DisposHandle for the
  29422. data handle, the Control Manager procedure DisposeControl for both scroll bars (if
  29423. they’re there), and DisposHandle for the list record.
  29424.  
  29425. Note:  Calling LDispose is much faster than deleting one row at a time.
  29426.  
  29427. Assembly-language note:  You can invoke each of the List Manager routines
  29428.                          with a macro that has the same name as the routine
  29429.                          preceded by an underscore. These macros expand to
  29430.                          invoke to trap macro _Pack 0. The package determines
  29431.                          which routine to execute from a routine selector, an
  29432.                          integer that’s passed to it in a word on the stack.
  29433.                          The routine selectors are as follows:
  29434.  
  29435.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29436.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29437.                            lAddRow     .EQU    8    lClick       .EQU    24
  29438.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29439.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29440.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29441.                            lDispose    .EQU    40   lRect        .EQU    76
  29442.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29443.                            lDraw       .EQU    48   lSearch      .EQU    84
  29444.                            lFind       .EQU    52   lSetCell     .EQU    88
  29445.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29446.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29447.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29448.  
  29449. æKY LAddColumn
  29450. æFp Lists.p
  29451. æT FUNCTION
  29452. æTN $A9E7
  29453. æD FUNCTION LAddColumn(count: INTEGER;colNum: INTEGER;lHandle: ListHandle): INTEGER;
  29454.     INLINE $3F3C,$0004,$A9E7;
  29455. æDT myVariable := LAddColumn(count,colNum,lHandle);
  29456. æRI IV-271
  29457. æC 
  29458. LAddColumn inserts into the given list the number of columns specified by the count
  29459. parameter, starting at the column specified by colNum. Column numbers that are greater
  29460. than or equal to colNum are increased by count. If colNum is not within dataBounds,
  29461. new last columns are added. The number of the first added column is returned and
  29462. dataBounds.right is increased by count. All cells added are empty. If there are no
  29463. cells (because dataBounds.top = dataBounds.bottom), no cells are added, but dataBounds
  29464. is still extended. If drawing is on and the added columns (which are empty) are
  29465. visible, the list and its scroll bars are updated.
  29466.  
  29467. Assembly-language note:  You can invoke each of the List Manager routines
  29468.                          with a macro that has the same name as the routine
  29469.                          preceded by an underscore. These macros expand to
  29470.                          invoke to trap macro _Pack 0. The package determines
  29471.                          which routine to execute from a routine selector, an
  29472.                          integer that’s passed to it in a word on the stack.
  29473.                          The routine selectors are as follows:
  29474.  
  29475.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29476.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29477.                            lAddRow     .EQU    8    lClick       .EQU    24
  29478.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29479.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29480.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29481.                            lDispose    .EQU    40   lRect        .EQU    76
  29482.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29483.                            lDraw       .EQU    48   lSearch      .EQU    84
  29484.                            lFind       .EQU    52   lSetCell     .EQU    88
  29485.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29486.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29487.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29488.  
  29489. æKY LAddRow
  29490. æFp Lists.p
  29491. æT FUNCTION
  29492. æTN $A9E7
  29493. æD FUNCTION LAddRow(count: INTEGER;rowNum: INTEGER;lHandle: ListHandle): INTEGER;
  29494.     INLINE $3F3C,$0008,$A9E7;
  29495. æDT myVariable := LAddRow(count,rowNum,lHandle);
  29496. æRI IV-271
  29497. æC 
  29498. LAddRow inserts the number of rows specified by the count parameter, starting at the
  29499. row specified by rowNum. Row numbers that are greater than or equal to rowNum are
  29500. increased by count. If rowNum is not within dataBounds, new last rows are added. The
  29501. number of the first added row is returned, and dataBounds.bottom is increased by
  29502. count. All cells added are empty. If there are no cells
  29503. (because dataBounds.left = dataBounds.right), no cells are added, but dataBounds is
  29504. still extended. If drawing is on and the added rows (which are empty) are visible,
  29505. the list and its scroll bars are updated.
  29506.  
  29507. Assembly-language note:  You can invoke each of the List Manager routines
  29508.                          with a macro that has the same name as the routine
  29509.                          preceded by an underscore. These macros expand to
  29510.                          invoke to trap macro _Pack 0. The package determines
  29511.                          which routine to execute from a routine selector, an
  29512.                          integer that’s passed to it in a word on the stack.
  29513.                          The routine selectors are as follows:
  29514.  
  29515.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29516.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29517.                            lAddRow     .EQU    8    lClick       .EQU    24
  29518.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29519.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29520.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29521.                            lDispose    .EQU    40   lRect        .EQU    76
  29522.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29523.                            lDraw       .EQU    48   lSearch      .EQU    84
  29524.                            lFind       .EQU    52   lSetCell     .EQU    88
  29525.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29526.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29527.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29528.  
  29529. æKY LDelColumn
  29530. æFp Lists.p
  29531. æT PROCEDURE
  29532. æTN $A9E7
  29533. æD PROCEDURE LDelColumn(count: INTEGER;colNum: INTEGER;lHandle: ListHandle);
  29534.     INLINE $3F3C,$0020,$A9E7;
  29535. æDT LDelColumn(count,colNum,lHandle);
  29536. æRI IV-271
  29537. æC 
  29538. LDelColumn deletes the number of columns specified by the count parameter, starting
  29539. with the column specified by colNum. Column numbers that are greater than colNum are
  29540. decreased by count. If colNum is not within dataBounds, nothing is done. DataBounds.right
  29541. is decreased by count. If drawing is on and the deleted columns were visible, the
  29542. list and its scroll bars are updated.
  29543.  
  29544. If count is 0, or
  29545.  
  29546.   colNum = dataBounds.left AND count > = dataBounds.right – dataBounds.left
  29547.  
  29548. all the data in the list is quickly deleted, dataBounds.right is set to dataBounds.left,
  29549. and the number of rows is left unchanged.
  29550.  
  29551. Assembly-language note:  You can invoke each of the List Manager routines
  29552.                          with a macro that has the same name as the routine
  29553.                          preceded by an underscore. These macros expand to
  29554.                          invoke to trap macro _Pack 0. The package determines
  29555.                          which routine to execute from a routine selector, an
  29556.                          integer that’s passed to it in a word on the stack.
  29557.                          The routine selectors are as follows:
  29558.  
  29559.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29560.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29561.                            lAddRow     .EQU    8    lClick       .EQU    24
  29562.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29563.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29564.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29565.                            lDispose    .EQU    40   lRect        .EQU    76
  29566.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29567.                            lDraw       .EQU    48   lSearch      .EQU    84
  29568.                            lFind       .EQU    52   lSetCell     .EQU    88
  29569.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29570.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29571.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29572.  
  29573. æKY LDelRow
  29574. æFp Lists.p
  29575. æT PROCEDURE
  29576. æTN $A9E7
  29577. æD PROCEDURE LDelRow(count: INTEGER;rowNum: INTEGER;lHandle: ListHandle);
  29578.     INLINE $3F3C,$0024,$A9E7;
  29579. æDT LDelRow(count,rowNum,lHandle);
  29580. æRI IV-272
  29581. æC 
  29582. LDelRow deletes the number of rows specified by the count parameter, starting with
  29583. the row specified by rowNum. Row numbers that are greater than rowNum are decreased
  29584. by count. If rowNum is not within dataBounds, nothing is done. DataBounds.bottom is
  29585. decreased by count. If drawing is on and the deleted rows were visible, the list and
  29586. its scroll bars are updated.
  29587.  
  29588. If count is 0, or
  29589.  
  29590.   rowNum = dataBounds.top AND count > = dataBounds.bottom – dataBounds.top
  29591.  
  29592. all the data in the list is quickly deleted, dataBounds.bottom is set to dataBounds.top,
  29593. and the number of columns is left unchanged.
  29594.  
  29595. Assembly-language note:  You can invoke each of the List Manager routines
  29596.                          with a macro that has the same name as the routine
  29597.                          preceded by an underscore. These macros expand to
  29598.                          invoke to trap macro _Pack 0. The package determines
  29599.                          which routine to execute from a routine selector, an
  29600.                          integer that’s passed to it in a word on the stack.
  29601.                          The routine selectors are as follows:
  29602.  
  29603.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29604.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29605.                            lAddRow     .EQU    8    lClick       .EQU    24
  29606.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29607.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29608.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29609.                            lDispose    .EQU    40   lRect        .EQU    76
  29610.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29611.                            lDraw       .EQU    48   lSearch      .EQU    84
  29612.                            lFind       .EQU    52   lSetCell     .EQU    88
  29613.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29614.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29615.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29616.  
  29617. æKY LGetSelect
  29618. æFp Lists.p
  29619. æT FUNCTION
  29620. æTN $A9E7
  29621. æD FUNCTION LGetSelect(next: BOOLEAN;VAR theCell: Cell;lHandle: ListHandle): BOOLEAN;
  29622.     INLINE $3F3C,$003C,$A9E7;
  29623. æDT myVariable := LGetSelect(next,theCell,lHandle);
  29624. æRI IV-273
  29625. æC 
  29626. If next is FALSE, LGetSelect returns TRUE if the specified cell is selected, or FALSE
  29627. if not. If next is TRUE, LGetSelect returns in c the cell coordinates of the next
  29628. selected cell in the row that is greater than or equal to theCell. If there are no
  29629. more cells in the row, it returns in theCell the cell coordinates of the next selected
  29630. cell in the next row. If there are no more rows, FALSE is returned.
  29631.  
  29632. Assembly-language note:  You can invoke each of the List Manager routines
  29633.                          with a macro that has the same name as the routine
  29634.                          preceded by an underscore. These macros expand to
  29635.                          invoke to trap macro _Pack 0. The package determines
  29636.                          which routine to execute from a routine selector, an
  29637.                          integer that’s passed to it in a word on the stack.
  29638.                          The routine selectors are as follows:
  29639.  
  29640.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29641.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29642.                            lAddRow     .EQU    8    lClick       .EQU    24
  29643.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29644.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29645.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29646.                            lDispose    .EQU    40   lRect        .EQU    76
  29647.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29648.                            lDraw       .EQU    48   lSearch      .EQU    84
  29649.                            lFind       .EQU    52   lSetCell     .EQU    88
  29650.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29651.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29652.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29653.  
  29654. æKY LLastClick
  29655. æFp Lists.p
  29656. æT FUNCTION
  29657. æTN $A9E7
  29658. æD FUNCTION LLastClick(lHandle: ListHandle): Cell;
  29659.     INLINE $3F3C,$0040,$A9E7;
  29660. æDT myVariable := LLastClick(lHandle);
  29661. æRI IV-273
  29662. æC 
  29663. LLastClick returns the cell coordinates of the last cell clicked in. If no cell has
  29664. been clicked in since LNew, the value returned (for both integers) is negative.
  29665.  
  29666. Note:  The value returned by this call is not the last cell double-clicked
  29667.        in, or the last cell selected, but merely the last cell clicked in.
  29668.  
  29669. Assembly-language note:  You can invoke each of the List Manager routines
  29670.                          with a macro that has the same name as the routine
  29671.                          preceded by an underscore. These macros expand to
  29672.                          invoke to trap macro _Pack 0. The package determines
  29673.                          which routine to execute from a routine selector, an
  29674.                          integer that’s passed to it in a word on the stack.
  29675.                          The routine selectors are as follows:
  29676.  
  29677.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29678.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29679.                            lAddRow     .EQU    8    lClick       .EQU    24
  29680.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29681.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29682.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29683.                            lDispose    .EQU    40   lRect        .EQU    76
  29684.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29685.                            lDraw       .EQU    48   lSearch      .EQU    84
  29686.                            lFind       .EQU    52   lSetCell     .EQU    88
  29687.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29688.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29689.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29690.  
  29691. æKY LNextCell
  29692. æFp Lists.p
  29693. æT FUNCTION
  29694. æTN $A9E7
  29695. æD FUNCTION LNextCell(hNext: BOOLEAN;vNext: BOOLEAN;VAR theCell: Cell;lHandle: ListHandle): BOOLEAN;
  29696.     INLINE $3F3C,$0048,$A9E7;
  29697. æDT myVariable := LNextCell(hNext,vNext,theCell,lHandle);
  29698. æRI IV-274
  29699. æC 
  29700. Given a cell in theCell, LNextCell returns in theCell the next cell in the list. If
  29701. both hNext and vNext are TRUE, theCell is first advanced to the next cell in the row.
  29702. If there are no more cells in the row, theCell is set to the first cell in the next
  29703. row. If there are no more rows, FALSE is returned. If only hNext is TRUE, theCell is
  29704. advanced within the current row. If only vNext is TRUE, theCell is advanced within
  29705. the current column. FALSE is returned if there are no remaining cells in the row or
  29706. column.
  29707.  
  29708. Assembly-language note:  You can invoke each of the List Manager routines
  29709.                          with a macro that has the same name as the routine
  29710.                          preceded by an underscore. These macros expand to
  29711.                          invoke to trap macro _Pack 0. The package determines
  29712.                          which routine to execute from a routine selector, an
  29713.                          integer that’s passed to it in a word on the stack.
  29714.                          The routine selectors are as follows:
  29715.  
  29716.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29717.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29718.                            lAddRow     .EQU    8    lClick       .EQU    24
  29719.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29720.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29721.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29722.                            lDispose    .EQU    40   lRect        .EQU    76
  29723.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29724.                            lDraw       .EQU    48   lSearch      .EQU    84
  29725.                            lFind       .EQU    52   lSetCell     .EQU    88
  29726.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29727.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29728.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29729.  
  29730. æKY LSearch
  29731. æFp Lists.p
  29732. æT FUNCTION
  29733. æTN $A9E7
  29734. æD FUNCTION LSearch(dataPtr: Ptr;dataLen: INTEGER;searchProc: ProcPtr;VAR theCell: Cell;
  29735.     lHandle: ListHandle): BOOLEAN;
  29736.     INLINE $3F3C,$0054,$A9E7;
  29737. æDT myVariable := LSearch(dataPtr,dataLen,searchProc,theCell,lHandle);
  29738. æRI IV-274 
  29739. æC 
  29740. LSearch searches for the first cell greater than or equal to theCell that contains
  29741. the specified data. If a cell containing matching data is found, the function result
  29742. TRUE is returned, and the cell coordinates are returned in theCell. If searchProc is
  29743. NIL, the International Utilities Package function IUMagIDString is called to compare
  29744. the specified data with the contents of each cell. If searchProc is not NIL, the
  29745. routine pointed to by searchProc is called.
  29746.  
  29747. Note:  Your searchProc should have the same parameters as the
  29748.        IUMagIDString function.
  29749.  
  29750. Assembly-language note:  You can invoke each of the List Manager routines
  29751.                          with a macro that has the same name as the routine
  29752.                          preceded by an underscore. These macros expand to
  29753.                          invoke to trap macro _Pack 0. The package determines
  29754.                          which routine to execute from a routine selector, an
  29755.                          integer that’s passed to it in a word on the stack.
  29756.                          The routine selectors are as follows:
  29757.  
  29758.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29759.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29760.                            lAddRow     .EQU    8    lClick       .EQU    24
  29761.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29762.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29763.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29764.                            lDispose    .EQU    40   lRect        .EQU    76
  29765.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29766.                            lDraw       .EQU    48   lSearch      .EQU    84
  29767.                            lFind       .EQU    52   lSetCell     .EQU    88
  29768.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29769.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29770.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29771.  
  29772. æKY LSize
  29773. æFp Lists.p
  29774. æT PROCEDURE
  29775. æTN $A9E7
  29776. æD PROCEDURE LSize(listWidth: INTEGER;listHeight: INTEGER;lHandle: ListHandle);
  29777.     INLINE $3F3C,$0060,$A9E7;
  29778. æDT LSize(listWidth,listHeight,lHandle);
  29779. æRI IV-274 
  29780. æC 
  29781. You’ll usually call LSize immediately after the Window Manager procedure SizeWindow.
  29782. It causes the bottom right of the list to be adjusted so that the list is the width
  29783. and height indicated by listWidth and listHeight. The contents of the list and the
  29784. scroll bars are adjusted and redrawn as necessary. The values of listWidth and listHeight
  29785. do not include the scroll bars; for a list that entirely fills the window, listWidth
  29786. and listHeight should be 15 fewer pixels than the portRect if both scroll bars are
  29787. present.
  29788.  
  29789. Assembly-language note:  You can invoke each of the List Manager routines
  29790.                          with a macro that has the same name as the routine
  29791.                          preceded by an underscore. These macros expand to
  29792.                          invoke to trap macro _Pack 0. The package determines
  29793.                          which routine to execute from a routine selector, an
  29794.                          integer that’s passed to it in a word on the stack.
  29795.                          The routine selectors are as follows:
  29796.  
  29797.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29798.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29799.                            lAddRow     .EQU    8    lClick       .EQU    24
  29800.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29801.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29802.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29803.                            lDispose    .EQU    40   lRect        .EQU    76
  29804.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29805.                            lDraw       .EQU    48   lSearch      .EQU    84
  29806.                            lFind       .EQU    52   lSetCell     .EQU    88
  29807.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29808.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29809.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29810.  
  29811. æKY LDoDraw
  29812. æFp Lists.p
  29813. æT PROCEDURE
  29814. æTN $A9E7
  29815. æD PROCEDURE LDoDraw(drawIt: BOOLEAN;lHandle: ListHandle);
  29816.     INLINE $3F3C,$002C,$A9E7;
  29817. æDT LDoDraw(drawIt,lHandle);
  29818. æRI IV-275 
  29819. æC 
  29820. LDoDraw sets the List Manager’s drawing mode to the state specified by drawIt. If
  29821. drawIt is TRUE, changes made by most List Manager calls will cause some sort of
  29822. drawing to take place. If drawIt is FALSE, all cell drawing is disabled.
  29823. (Two exceptions:  The scroll bars are still updated after LSize, and the scroll
  29824. arrows are still highlighted if the user clicks them.)
  29825.  
  29826. The recommended use of LDoDraw is to disable drawing while you’re building a list
  29827. (that is, adding rows or columns, setting or changing cell values, or setting default
  29828. selections). Once you’ve finished building the list, you should then re-enable drawing.
  29829. In general, drawing should be on while you’re in your event loop and dispatching
  29830. events to the List Manager.
  29831.  
  29832. Assembly-language note:  You can invoke each of the List Manager routines
  29833.                          with a macro that has the same name as the routine
  29834.                          preceded by an underscore. These macros expand to
  29835.                          invoke to trap macro _Pack 0. The package determines
  29836.                          which routine to execute from a routine selector, an
  29837.                          integer that’s passed to it in a word on the stack.
  29838.                          The routine selectors are as follows:
  29839.  
  29840.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29841.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29842.                            lAddRow     .EQU    8    lClick       .EQU    24
  29843.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29844.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29845.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29846.                            lDispose    .EQU    40   lRect        .EQU    76
  29847.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29848.                            lDraw       .EQU    48   lSearch      .EQU    84
  29849.                            lFind       .EQU    52   lSetCell     .EQU    88
  29850.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29851.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29852.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29853.  
  29854. æKY LScroll
  29855. æFp Lists.p
  29856. æT PROCEDURE
  29857. æTN $A9E7
  29858. æD PROCEDURE LScroll(dCols: INTEGER;dRows: INTEGER;lHandle: ListHandle);
  29859.     INLINE $3F3C,$0050,$A9E7;
  29860. æDT LScroll(dCols,dRows,lHandle);
  29861. æRI IV-275 
  29862. æC 
  29863. LScroll scrolls the given list by the number of columns and rows specified in dCols
  29864. and dRows, either positively (down and to the right) or negatively (up and to the
  29865. left). Scrolling is pinned to the list’s dataBounds. If drawing is on, LScroll does
  29866. all necessary updating of the screen.
  29867.  
  29868. Assembly-language note:  You can invoke each of the List Manager routines
  29869.                          with a macro that has the same name as the routine
  29870.                          preceded by an underscore. These macros expand to
  29871.                          invoke to trap macro _Pack 0. The package determines
  29872.                          which routine to execute from a routine selector, an
  29873.                          integer that’s passed to it in a word on the stack.
  29874.                          The routine selectors are as follows:
  29875.  
  29876.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29877.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29878.                            lAddRow     .EQU    8    lClick       .EQU    24
  29879.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29880.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29881.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29882.                            lDispose    .EQU    40   lRect        .EQU    76
  29883.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29884.                            lDraw       .EQU    48   lSearch      .EQU    84
  29885.                            lFind       .EQU    52   lSetCell     .EQU    88
  29886.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29887.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29888.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29889.  
  29890. æKY LAutoScroll
  29891. æFp Lists.p
  29892. æT PROCEDURE
  29893. æTN $A9E7
  29894. æD PROCEDURE LAutoScroll(lHandle: ListHandle);
  29895.     INLINE $3F3C,$0010,$A9E7;
  29896. æDT LAutoScroll(lHandle);
  29897. æRI IV-275
  29898. æC 
  29899. For the given list, LAutoScroll scrolls the list until the first selected cell is
  29900. visible. It automatically places the first selected cell in the top left corner of
  29901. the visible rectangle.
  29902.  
  29903. Assembly-language note:  You can invoke each of the List Manager routines
  29904.                          with a macro that has the same name as the routine
  29905.                          preceded by an underscore. These macros expand to
  29906.                          invoke to trap macro _Pack 0. The package determines
  29907.                          which routine to execute from a routine selector, an
  29908.                          integer that’s passed to it in a word on the stack.
  29909.                          The routine selectors are as follows:
  29910.  
  29911.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29912.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29913.                            lAddRow     .EQU    8    lClick       .EQU    24
  29914.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29915.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29916.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29917.                            lDispose    .EQU    40   lRect        .EQU    76
  29918.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29919.                            lDraw       .EQU    48   lSearch      .EQU    84
  29920.                            lFind       .EQU    52   lSetCell     .EQU    88
  29921.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29922.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29923.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29924.  
  29925. æKY LUpdate
  29926. æFp Lists.p
  29927. æT PROCEDURE
  29928. æTN ,$A9E7
  29929. æD PROCEDURE LUpdate(theRgn: RgnHandle;lHandle: ListHandle);
  29930.     INLINE $3F3C,$0064,$A9E7;
  29931. æDT LUpdate(theRgn,lHandle);
  29932. æRI IV-275
  29933. æC 
  29934. LUpdate should be called in response to an update event. TheRgn should be set to the
  29935. visRgn of the list’s port (for more details, see the BeginUpdate procedure in the
  29936. Window Manager chapter). It redraws any visible cells in lHandle that intersect
  29937. theRgn. It also redraws the controls, if necessary.
  29938.  
  29939. Assembly-language note:  You can invoke each of the List Manager routines
  29940.                          with a macro that has the same name as the routine
  29941.                          preceded by an underscore. These macros expand to
  29942.                          invoke to trap macro _Pack 0. The package determines
  29943.                          which routine to execute from a routine selector, an
  29944.                          integer that’s passed to it in a word on the stack.
  29945.                          The routine selectors are as follows:
  29946.  
  29947.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29948.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29949.                            lAddRow     .EQU    8    lClick       .EQU    24
  29950.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29951.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29952.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29953.                            lDispose    .EQU    40   lRect        .EQU    76
  29954.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29955.                            lDraw       .EQU    48   lSearch      .EQU    84
  29956.                            lFind       .EQU    52   lSetCell     .EQU    88
  29957.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29958.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29959.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29960.  
  29961. æKY LActivate
  29962. æFp Lists.p
  29963. æT PROCEDURE
  29964. æTN $A9E7
  29965. æD PROCEDURE LActivate(act: BOOLEAN;lHandle: ListHandle);
  29966.     INLINE $3F3C,$0000,$A9E7;
  29967. æDT LActivate(act,lHandle);
  29968. æRI IV-276 
  29969. æC 
  29970. Call LActivate to activate or deactivate the list specified by lHandle (in response
  29971. to an activate event in the window containing the list). The act parameter should be
  29972. set to TRUE to activate the list, or FALSE to deactivate the list. LActivate highlights
  29973. or unhighlights the selections, and shows or hides the scroll bars (but not the size
  29974. box, if any).
  29975.  
  29976. Assembly-language note:  You can invoke each of the List Manager routines
  29977.                          with a macro that has the same name as the routine
  29978.                          preceded by an underscore. These macros expand to
  29979.                          invoke to trap macro _Pack 0. The package determines
  29980.                          which routine to execute from a routine selector, an
  29981.                          integer that’s passed to it in a word on the stack.
  29982.                          The routine selectors are as follows:
  29983.  
  29984.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  29985.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  29986.                            lAddRow     .EQU    8    lClick       .EQU    24
  29987.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  29988.                            lDelColumn  .EQU    32   lNew         .EQU    68
  29989.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  29990.                            lDispose    .EQU    40   lRect        .EQU    76
  29991.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  29992.                            lDraw       .EQU    48   lSearch      .EQU    84
  29993.                            lFind       .EQU    52   lSetCell     .EQU    88
  29994.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  29995.                            lGetSelect  .EQU    60   lSize        .EQU    96
  29996.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  29997.  
  29998. æKY LCellSize
  29999. æFp Lists.p
  30000. æT PROCEDURE
  30001. æTN $A9E7
  30002. æD PROCEDURE LCellSize(cSize: Point;lHandle: ListHandle);
  30003.     INLINE $3F3C,$0014,$A9E7;
  30004. æDT LCellSize(cSize,lHandle);
  30005. æRI IV-273
  30006. æC 
  30007. LCellSize sets the cellSize field in the list record to cSize and updates the visible
  30008. rectangle to contain cells of this size. This command should be used only before any
  30009. cells have been drawn.
  30010.  
  30011. Assembly-language note:  You can invoke each of the List Manager routines
  30012.                          with a macro that has the same name as the routine
  30013.                          preceded by an underscore. These macros expand to
  30014.                          invoke to trap macro _Pack 0. The package determines
  30015.                          which routine to execute from a routine selector, an
  30016.                          integer that’s passed to it in a word on the stack.
  30017.                          The routine selectors are as follows:
  30018.  
  30019.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30020.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30021.                            lAddRow     .EQU    8    lClick       .EQU    24
  30022.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30023.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30024.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30025.                            lDispose    .EQU    40   lRect        .EQU    76
  30026.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30027.                            lDraw       .EQU    48   lSearch      .EQU    84
  30028.                            lFind       .EQU    52   lSetCell     .EQU    88
  30029.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30030.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30031.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30032.  
  30033. æKY LClick
  30034. æFp Lists.p
  30035. æT FUNCTION
  30036. æTN $A9E7
  30037. æD FUNCTION LClick(pt: Point;modifiers: INTEGER;lHandle: ListHandle): BOOLEAN;
  30038.     INLINE $3F3C,$0018,$A9E7;
  30039. æDT myVariable := LClick(pt,modifiers,lHandle);
  30040. æRI IV-273
  30041. æC 
  30042. Call LClick when there is a mouse-down event in the destination rectangle or its
  30043. scroll bars. Pt is the mouse location in local coordinates. Modifiers is the modifiers
  30044. word from the event record. LHandle is the list to be tracked. The result is TRUE if
  30045. a double-click occurred (and the two clicks took place within the same cell).
  30046.  
  30047. LClick keeps control until the mouse is released; each time through its inner loop,
  30048. it calls the routine whose pointer is in the lClikLoop field of the list record.
  30049.  
  30050. If the mouse is in the visible rectangle, cells are selected according to the state
  30051. of the modifiers and the selection flags. If the mouse was in the cells but is dragged
  30052. outside the list’s rectangle, the list is auto-scrolled. If the mouse was in a control,
  30053. the control’s definition procedure is called to track the mouse. To discover which
  30054. cell was clicked in, use the LLastClick function.
  30055.  
  30056. Assembly-language note:  You can invoke each of the List Manager routines
  30057.                          with a macro that has the same name as the routine
  30058.                          preceded by an underscore. These macros expand to
  30059.                          invoke to trap macro _Pack 0. The package determines
  30060.                          which routine to execute from a routine selector, an
  30061.                          integer that’s passed to it in a word on the stack.
  30062.                          The routine selectors are as follows:
  30063.  
  30064.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30065.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30066.                            lAddRow     .EQU    8    lClick       .EQU    24
  30067.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30068.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30069.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30070.                            lDispose    .EQU    40   lRect        .EQU    76
  30071.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30072.                            lDraw       .EQU    48   lSearch      .EQU    84
  30073.                            lFind       .EQU    52   lSetCell     .EQU    88
  30074.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30075.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30076.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30077.  
  30078. æKY LAddToCell
  30079. æFp Lists.p
  30080. æT PROCEDURE
  30081. æTN $A9E7
  30082. æD PROCEDURE LAddToCell(dataPtr: Ptr;dataLen: INTEGER;theCell: Cell;lHandle: ListHandle);
  30083.     INLINE $3F3C,$000C,$A9E7;
  30084. æDT LAddToCell(dataPtr,dataLen,theCell,lHandle);
  30085. æRI IV-272
  30086. æC 
  30087. LAddToCell appends the data pointed to by dataPtr and of length dataLen to the cell
  30088. specified by theCell in lHandle. If drawing is off, you must turn drawing on and call
  30089. LDraw (or LUpdate) to display the cell’s new value.
  30090.  
  30091. Assembly-language note:  You can invoke each of the List Manager routines
  30092.                          with a macro that has the same name as the routine
  30093.                          preceded by an underscore. These macros expand to
  30094.                          invoke to trap macro _Pack 0. The package determines
  30095.                          which routine to execute from a routine selector, an
  30096.                          integer that’s passed to it in a word on the stack.
  30097.                          The routine selectors are as follows:
  30098.  
  30099.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30100.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30101.                            lAddRow     .EQU    8    lClick       .EQU    24
  30102.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30103.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30104.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30105.                            lDispose    .EQU    40   lRect        .EQU    76
  30106.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30107.                            lDraw       .EQU    48   lSearch      .EQU    84
  30108.                            lFind       .EQU    52   lSetCell     .EQU    88
  30109.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30110.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30111.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30112.  
  30113. æKY LClrCell
  30114. æFp Lists.p
  30115. æT PROCEDURE
  30116. æTN $A9E7
  30117. æD PROCEDURE LClrCell(theCell: Cell;lHandle: ListHandle);
  30118.     INLINE $3F3C,$001C,$A9E7;
  30119. æDT LClrCell(theCell,lHandle);
  30120. æRI IV-272
  30121. æC 
  30122. LClrCell clears the contents of the specified cell (by setting the length to 0). If
  30123. theCell is not a valid cell, nothing is done. If drawing is off, you must turn drawing
  30124. on and call LDraw to display the cell’s new value (or simply call the Window Manager
  30125. procedure InvalRect).
  30126.  
  30127. Assembly-language note:  You can invoke each of the List Manager routines
  30128.                          with a macro that has the same name as the routine
  30129.                          preceded by an underscore. These macros expand to
  30130.                          invoke to trap macro _Pack 0. The package determines
  30131.                          which routine to execute from a routine selector, an
  30132.                          integer that’s passed to it in a word on the stack.
  30133.                          The routine selectors are as follows:
  30134.  
  30135.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30136.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30137.                            lAddRow     .EQU    8    lClick       .EQU    24
  30138.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30139.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30140.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30141.                            lDispose    .EQU    40   lRect        .EQU    76
  30142.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30143.                            lDraw       .EQU    48   lSearch      .EQU    84
  30144.                            lFind       .EQU    52   lSetCell     .EQU    88
  30145.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30146.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30147.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30148.  
  30149. æKY LGetCell
  30150. æFp Lists.p
  30151. æT PROCEDURE
  30152. æTN $A9E7
  30153. æD PROCEDURE LGetCell(dataPtr: Ptr;VAR dataLen: INTEGER;theCell: Cell;lHandle: ListHandle);
  30154.     INLINE $3F3C,$0038,$A9E7;
  30155. æDT LGetCell(dataPtr,dataLen,theCell,lHandle);
  30156. æRI IV-272
  30157. æC 
  30158. Given a cell in theCell, LGetCell copies the cell’s data to the location specified by
  30159. dataPtr; dataLen is the maximum number of bytes allowed. If the data is longer than
  30160. dataLen, only dataLen bytes are copied into the location specified by dataPtr. If the
  30161. data is shorter than dataLen, dataLen is set to the true length of the cell’s data.
  30162.  
  30163. Assembly-language note:  You can invoke each of the List Manager routines
  30164.                          with a macro that has the same name as the routine
  30165.                          preceded by an underscore. These macros expand to
  30166.                          invoke to trap macro _Pack 0. The package determines
  30167.                          which routine to execute from a routine selector, an
  30168.                          integer that’s passed to it in a word on the stack.
  30169.                          The routine selectors are as follows:
  30170.  
  30171.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30172.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30173.                            lAddRow     .EQU    8    lClick       .EQU    24
  30174.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30175.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30176.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30177.                            lDispose    .EQU    40   lRect        .EQU    76
  30178.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30179.                            lDraw       .EQU    48   lSearch      .EQU    84
  30180.                            lFind       .EQU    52   lSetCell     .EQU    88
  30181.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30182.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30183.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30184.  
  30185. æKY LFind
  30186. æFp Lists.p
  30187. æT PROCEDURE
  30188. æTN $A9E7
  30189. æD PROCEDURE LFind(VAR offset: INTEGER;VAR len: INTEGER;theCell: Cell;lHandle: ListHandle);
  30190.     INLINE $3F3C,$0034,$A9E7;
  30191. æDT LFind(offset,len,theCell,lHandle);
  30192. æRI IV-274
  30193. æC  
  30194. Given a cell in theCell, LFind returns the offset and the length in bytes of the
  30195. cell’s data. If an invalid cell is specified, offset and len are set to –1. A similar
  30196. procedure, LGetCell, is more convenient to use from Pascal.
  30197.  
  30198. Assembly-language note:  You can invoke each of the List Manager routines
  30199.                          with a macro that has the same name as the routine
  30200.                          preceded by an underscore. These macros expand to
  30201.                          invoke to trap macro _Pack 0. The package determines
  30202.                          which routine to execute from a routine selector, an
  30203.                          integer that’s passed to it in a word on the stack.
  30204.                          The routine selectors are as follows:
  30205.  
  30206.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30207.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30208.                            lAddRow     .EQU    8    lClick       .EQU    24
  30209.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30210.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30211.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30212.                            lDispose    .EQU    40   lRect        .EQU    76
  30213.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30214.                            lDraw       .EQU    48   lSearch      .EQU    84
  30215.                            lFind       .EQU    52   lSetCell     .EQU    88
  30216.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30217.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30218.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30219.  
  30220. æKY LRect
  30221. æFp Lists.p
  30222. æT PROCEDURE
  30223. æTN $A9E7
  30224. æD PROCEDURE LRect(VAR cellRect: Rect;theCell: Cell;lHandle: ListHandle);
  30225.     INLINE $3F3C,$004C,$A9E7;
  30226. æDT LRect(cellRect,theCell,lHandle);
  30227. æRI IV-274
  30228. æC 
  30229. LRect returns in cellRect the local (QuickDraw) coordinates of the cell specified by
  30230. theCell. If an invalid cell is specified, (0,0)(0,0) is returned in cellRect.
  30231.  
  30232. Assembly-language note:  You can invoke each of the List Manager routines
  30233.                          with a macro that has the same name as the routine
  30234.                          preceded by an underscore. These macros expand to
  30235.                          invoke to trap macro _Pack 0. The package determines
  30236.                          which routine to execute from a routine selector, an
  30237.                          integer that’s passed to it in a word on the stack.
  30238.                          The routine selectors are as follows:
  30239.  
  30240.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30241.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30242.                            lAddRow     .EQU    8    lClick       .EQU    24
  30243.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30244.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30245.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30246.                            lDispose    .EQU    40   lRect        .EQU    76
  30247.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30248.                            lDraw       .EQU    48   lSearch      .EQU    84
  30249.                            lFind       .EQU    52   lSetCell     .EQU    88
  30250.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30251.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30252.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30253.  
  30254. æKY LSetCell
  30255. æFp Lists.p
  30256. æT PROCEDURE
  30257. æTN $A9E7
  30258. æD PROCEDURE LSetCell(dataPtr: Ptr;dataLen: INTEGER;theCell: Cell;lHandle: ListHandle);
  30259.     INLINE $3F3C,$0058,$A9E7;
  30260. æDT LSetCell(dataPtr,dataLen,theCell,lHandle);
  30261. æRI IV-272
  30262. æC 
  30263. LSetCell places the data pointed to by dataPtr and of length dataLen into the specified
  30264. cell. It replaces any data that was already in the cell. If dataLen is 0, this is
  30265. equivalent to LClrCell. If theCell is not a valid cell, nothing is done. If drawing
  30266. is off, you must turn drawing on and call LDraw (or LUpdate) to display the cell’s
  30267. new value.
  30268.  
  30269. Assembly-language note:  You can invoke each of the List Manager routines
  30270.                          with a macro that has the same name as the routine
  30271.                          preceded by an underscore. These macros expand to
  30272.                          invoke to trap macro _Pack 0. The package determines
  30273.                          which routine to execute from a routine selector, an
  30274.                          integer that’s passed to it in a word on the stack.
  30275.                          The routine selectors are as follows:
  30276.  
  30277.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30278.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30279.                            lAddRow     .EQU    8    lClick       .EQU    24
  30280.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30281.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30282.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30283.                            lDispose    .EQU    40   lRect        .EQU    76
  30284.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30285.                            lDraw       .EQU    48   lSearch      .EQU    84
  30286.                            lFind       .EQU    52   lSetCell     .EQU    88
  30287.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30288.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30289.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30290.  
  30291. æKY LSetSelect
  30292. æFp Lists.p
  30293. æT PROCEDURE
  30294. æTN $A9E7
  30295. æD PROCEDURE LSetSelect(setIt: BOOLEAN;theCell: Cell;lHandle: ListHandle);
  30296.     INLINE $3F3C,$005C,$A9E7;
  30297. æDT LSetSelect(setIt,theCell,lHandle);
  30298. æRI IV-273
  30299. æC 
  30300. If setIt is TRUE, LSetSelect selects the cell and redraws if it is visible and was
  30301. previously unselected. If setIt is FALSE, it deselects the cell and redraws if necessary.
  30302.  
  30303. Assembly-language note:  You can invoke each of the List Manager routines
  30304.                          with a macro that has the same name as the routine
  30305.                          preceded by an underscore. These macros expand to
  30306.                          invoke to trap macro _Pack 0. The package determines
  30307.                          which routine to execute from a routine selector, an
  30308.                          integer that’s passed to it in a word on the stack.
  30309.                          The routine selectors are as follows:
  30310.  
  30311.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30312.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30313.                            lAddRow     .EQU    8    lClick       .EQU    24
  30314.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30315.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30316.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30317.                            lDispose    .EQU    40   lRect        .EQU    76
  30318.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30319.                            lDraw       .EQU    48   lSearch      .EQU    84
  30320.                            lFind       .EQU    52   lSetCell     .EQU    88
  30321.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30322.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30323.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30324.  
  30325. æKY LDraw
  30326. æFp Lists.p
  30327. æT PROCEDURE
  30328. æTN $A9E7
  30329. æD PROCEDURE LDraw(theCell: Cell;lHandle: ListHandle);
  30330.     INLINE $3F3C,$0030,$A9E7;
  30331. æDT LDraw(theCell,lHandle);
  30332. æRI IV-275 
  30333. æC 
  30334. Call LDraw after updating a cell’s data or selection status. (You can achieve the
  30335. same result by invalidating the cell’s rectangle and calling LUpdate in response to
  30336. the update event.) The List Manager makes its grafPort the current port, sets the
  30337. clipping region to the cell’s rectangle, and calls the list definition procedure to
  30338. draw the cell. It restores the clipping region and port before exiting.
  30339.  
  30340. Assembly-language note:  You can invoke each of the List Manager routines
  30341.                          with a macro that has the same name as the routine
  30342.                          preceded by an underscore. These macros expand to
  30343.                          invoke to trap macro _Pack 0. The package determines
  30344.                          which routine to execute from a routine selector, an
  30345.                          integer that’s passed to it in a word on the stack.
  30346.                          The routine selectors are as follows:
  30347.  
  30348.                            lActivate   .EQU    0    lAutoScroll  .EQU    16
  30349.                            lAddColumn  .EQU    4    lCellSize    .EQU    20
  30350.                            lAddRow     .EQU    8    lClick       .EQU    24
  30351.                            lAddToCell  .EQU    12   lClrCell     .EQU    28
  30352.                            lDelColumn  .EQU    32   lNew         .EQU    68
  30353.                            lDelRow     .EQU    36   lNextCell    .EQU    72
  30354.                            lDispose    .EQU    40   lRect        .EQU    76
  30355.                            lDoDraw     .EQU    44   lScroll      .EQU    80
  30356.                            lDraw       .EQU    48   lSearch      .EQU    84
  30357.                            lFind       .EQU    52   lSetCell     .EQU    88
  30358.                            lGetCell    .EQU    56   lSetSelect   .EQU    92
  30359.                            lGetSelect  .EQU    60   lSize        .EQU    96
  30360.                            lLastClick  .EQU    64   lUpdate      .EQU    100
  30361.  
  30362.  
  30363. æKY Memory.p
  30364. æKL ApplicZone
  30365. BlockMove
  30366. CompactMem
  30367. DisposHandle
  30368. DisposPtr
  30369. EmptyHandle
  30370. FreeMem
  30371. GetApplLimit
  30372. GetHandleSize
  30373. GetPtrSize
  30374. GetZone
  30375. GZSaveHnd
  30376. HandleZone
  30377. HClrRBit
  30378. HGetState
  30379. HLock
  30380. HNoPurge
  30381. HPurge
  30382. HSetRBit
  30383. HSetState
  30384. HUnlock
  30385. InitApplZone
  30386. InitZone
  30387. MaxApplZone
  30388. MaxBlock
  30389. MaxMem
  30390. MemError
  30391. MFFreeMem
  30392. MFMaxMem
  30393. MFTempDisposHandle
  30394. MFTempHLock
  30395. MFTempHUnlock
  30396. MFTempNewHandle
  30397. MFTopMem
  30398. MoreMasters
  30399. MoveHHi
  30400. NewEmptyHandle
  30401. NewHandle
  30402. NewHandleClear
  30403. NewHandleSys
  30404. NewHandleSysClear
  30405. NewPtr
  30406. NewPtrClear
  30407. NewPtrSys
  30408. NewPtrSysClear
  30409. PtrZone
  30410. PurgeMem
  30411. PurgeSpace
  30412. ReallocHandle
  30413. RecoverHandle
  30414. ResrvMem
  30415. SetApplBase
  30416. SetApplLimit
  30417. SetGrowZone
  30418. SetHandleSize
  30419. SetPtrSize
  30420. SetZone
  30421. StackSpace
  30422. StripAddress
  30423. SystemZone
  30424. TopMem
  30425.  
  30426. maxSize
  30427. Size
  30428. THz
  30429. Zone
  30430.  
  30431. æKY maxSize
  30432. æFp Memory.p
  30433. æT CONST
  30434. æD maxSize = $800000; {Max data block size is 8 megabytes}
  30435. æC 
  30436.  
  30437. æKY Zone
  30438. THz
  30439. æFp Memory.p
  30440. æT RECORD
  30441. æD THz = ^Zone;
  30442. Zone = RECORD
  30443.     bkLim: Ptr;
  30444.     purgePtr: Ptr;
  30445.     hFstFree: Ptr;
  30446.     zcbFree: LONGINT;
  30447.     gzProc: ProcPtr;
  30448.     moreMast: INTEGER;
  30449.     flags: INTEGER;
  30450.     cntRel: INTEGER;
  30451.     maxRel: INTEGER;
  30452.     cntNRel: INTEGER;
  30453.     maxNRel: INTEGER;
  30454.     cntEmpty: INTEGER;
  30455.     cntHandles: INTEGER;
  30456.     minCBFree: LONGINT;
  30457.     purgeProc: ProcPtr;
  30458.     sparePtr: Ptr;
  30459.     allocPtr: Ptr;
  30460.     heapData: INTEGER;
  30461.     END;
  30462. æC 
  30463. »Structure of Heap Zones
  30464.  
  30465. Each heap zone begins with a 52-byte zone header and ends with a 12-byte zone trailer
  30466. (see Figure 11). The header contains all the information the Memory Manager needs
  30467. about that heap zone; the trailer is just a minimum-size free block (described in the
  30468. next section) placed at the end of the zone as a marker. All the remaining space
  30469. between the header and trailer is available for allocation.
  30470.  
  30471. In Pascal, a heap zone is defined as a zone record of type Zone. It’s always referred
  30472. to with a zone pointer of type THz (“the heap zone”):
  30473.  
  30474. TYPE  THz  = ^Zone;
  30475.       Zone = RECORD
  30476.                bkLim:       Ptr;      {zone trailer block}
  30477.                purgePtr:    Ptr;      {used internally}
  30478.                hFstFree:    Ptr;      {first free master pointer}
  30479.                zcbFree:     LONGINT;  {number of free bytes}
  30480.                gzProc:      ProcPtr;  {grow zone function}
  30481.                moreMast:    INTEGER;  {master pointers to allocate}
  30482.                flags:       INTEGER;  {used internally}
  30483.                cntRel:      INTEGER;  {not used}
  30484.                maxRel:      INTEGER;  {not used}
  30485.                cntNRel:     INTEGER;  {not used}
  30486.                maxNRel:     INTEGER;  {not used}
  30487.                cntEmpty:    INTEGER;  {not used}
  30488.                cntHandles:  INTEGER;  {not used}
  30489.                minCBFree:   LONGINT;  {not used}
  30490.                purgeProc:   ProcPtr;  {purge warning procedure}
  30491.                sparePtr:    Ptr;      {used internally}
  30492.                allocPtr:    Ptr;      {used internally}
  30493.                heapData:    INTEGER   {first usable byte in zone}
  30494.              END;
  30495.  
  30496. Warning:  The fields of the zone header are for the Memory Manager’s own
  30497.           internal use. You can examine the contents of the zone’s fields,
  30498.           but in general it doesn’t make sense for your program to try to
  30499.           change them. The few exceptions are noted below in the discussions
  30500.           of the specific fields.
  30501.  
  30502. BkLim is a pointer to the zone’s trailer block. Since the trailer is the last block
  30503. in the zone, bkLim is a pointer to the byte following the last byte of usable space
  30504. in the zone.
  30505.  
  30506. HFstFree is a pointer to the first free master pointer in the zone. Instead of just
  30507. allocating space for one master pointer each time a relocatable block is created, the
  30508. Memory Manager “preallocates” several master pointers at a time; as a group they form
  30509. a nonrelocatable block. The moreMast field of the zone record tells the Memory Manager
  30510. how many master pointers at a time to preallocate for this zone.
  30511.  
  30512. Note:  Master pointers are allocated 32 at a time for the system heap zone
  30513.        and 64 at a time for the application zone; this may be different on
  30514.        future versions of the Macintosh.
  30515.  
  30516. All master pointers that are allocated but not currently in use are linked together
  30517. into a list beginning in the hFstFree field. When you allocate a new relocatable
  30518. block, the Memory Manager removes the first available master pointer from this list,
  30519. sets it to point to the new block, and returns its address to you as a handle to the
  30520. block. (If the list is empty, it allocates a fresh block of moreMast master pointers.)
  30521. When you release a relocatable block, its master pointer isn’t released, but is
  30522. linked onto the beginning of the list to be reused. Thus the amount of space devoted
  30523. to master pointers can increase, but can never decrease until the zone is reinitialized.
  30524.  
  30525. The zcbFree field always contains the number of free bytes remaining in the zone. As
  30526. blocks are allocated and released, the Memory Manager adjusts zcbFree accordingly.
  30527. This number represents an upper limit on the size of block you can allocate from this
  30528. heap zone.
  30529.  
  30530. Warning:  It may not actually be possible to allocate a block as big as
  30531.           zcbFree bytes. Because nonrelocatable and locked blocks can’t be
  30532.           moved, it isn’t always possible to collect all the free space into
  30533.           a single block by compaction.
  30534.  
  30535. The gzProc field is a pointer to the grow zone function. You can supply a pointer to
  30536. your own grow zone function when you create a new heap zone and can change it at any
  30537. time.
  30538.  
  30539. Warning:  Don’t store directly into the gzProc field; if you want to supply
  30540.           your own grow zone function, you must do so with a procedure call
  30541.           (InitZone or SetGrowZone).
  30542.  
  30543. PurgeProc is a pointer to the zone’s purge warning procedure, or NIL if there is
  30544. none. The Memory Manager will call this procedure before it purges a block from the
  30545. zone.
  30546.  
  30547. Warning:  Whenever you call the Resource Manager with SetResPurge(TRUE),
  30548.           it installs its own purge warning procedure, overriding any purge
  30549.           warning procedure you’ve specified to the Memory Manager; for further
  30550.           details, see the Resource Manager chapter.
  30551.  
  30552. The last field of a zone record, heapData, is a dummy field marking the bottom of the
  30553. zone’s usable memory space.
  30554.  
  30555. HeapData nominally contains an integer, but this integer has no significance in
  30556. itself—it’s just the first two bytes in the block header of the first block in the
  30557. zone. The purpose of the heapData field is to give you a way of locating the effective
  30558. bottom of the zone. For example, if myZone is a zone pointer, then
  30559.  
  30560.   @(myZone^.heapData)
  30561.  
  30562. is a pointer to the first usable byte in the zone, just as
  30563.  
  30564.   myZone^.bkLim
  30565.  
  30566. is a pointer to the byte following the last usable byte in the zone.
  30567.  
  30568. æKY Size
  30569. æFp Memory.p
  30570. æT RECORD
  30571. æD Size = LONGINT; { size of a block in bytes }
  30572. æC 
  30573. For specifying the sizes of blocks in the heap, the Memory Manager defines a special
  30574. type called Size:
  30575.  
  30576.   TYPE Size = LONGINT;
  30577.  
  30578. All Memory Manager routines that deal with block sizes expect parameters of type Size
  30579. or return them as results.
  30580.  
  30581. æKY GetApplLimit
  30582. æFp Memory.p
  30583. æT FUNCTION
  30584. æD FUNCTION GetApplLimit: Ptr;
  30585.     INLINE $2EB8,$0130;
  30586. æDT myVariable := GetApplLimit(paramList);
  30587. æRI II-29
  30588. æC 
  30589. GetApplLimit returns the current application heap limit. It can be used in conjunction
  30590. with SetApplLimit, described below, to determine and then change the application heap
  30591. limit.
  30592.  
  30593. Assembly-language note:  The global variable ApplLimit contains the
  30594.                          current application heap limit.
  30595.  
  30596. æKY GetZone
  30597. æFp Memory.p
  30598. æT FUNCTION
  30599. æD FUNCTION GetZone: THz;
  30600. æDT myVariable := GetZone(paramList);
  30601. æRI II-31
  30602. æC 
  30603. Trap macro  _GetZone
  30604. On exit     A0:  function result (pointer)
  30605.             D0:  result code (word)
  30606.  
  30607. GetZone returns a pointer to the current heap zone.
  30608.  
  30609. Assembly-language note:  The global variable TheZone contains a
  30610.                          pointer to the current heap zone.
  30611.  
  30612. Result codes    noErr    No error
  30613.  
  30614. æKY SystemZone
  30615. æFp Memory.p
  30616. æT FUNCTION
  30617. æD FUNCTION SystemZone: THz;
  30618.     INLINE $2EB8,$02A6;
  30619. æDT myVariable := SystemZone(paramList);
  30620. æRI II-32
  30621. æC 
  30622. [Not in ROM]
  30623.  
  30624. SystemZone returns a pointer to the system heap zone.
  30625.  
  30626. Assembly-language note:  The global variable SysZone contains
  30627.                          a pointer to the system heap zone.
  30628.  
  30629. æKY ApplicZone
  30630. æFp Memory.p
  30631. æT FUNCTION
  30632. æD FUNCTION ApplicZone: THz;
  30633.     INLINE $2EB8,$02AA;
  30634. æDT myVariable := ApplicZone(paramList);
  30635. æRI II-32, N83-1
  30636. æC  
  30637. [Not in ROM]
  30638.  
  30639. ApplicZone returns a pointer to the original application heap zone.
  30640.  
  30641. Assembly-language note:  The global variable ApplZone contains
  30642.                          a pointer to the original application heap zone.
  30643.  
  30644. æKY NewHandle
  30645. æFp Memory.p
  30646. æT FUNCTION
  30647. æD FUNCTION NewHandle(byteCount: Size): Handle;
  30648. æDT myVariable := NewHandle(byteCount);
  30649. æMM
  30650. æRT 7, 117, 205
  30651. æRI I-76, 80, II-32, N7-2, N117-17, P-51, 177
  30652. æC 
  30653. Trap macro  _NewHandle
  30654.             _NewHandle ,SYS        (applies to system heap)
  30655.             _NewHandle ,CLEAR      (clears allocated block)
  30656.             _NewHandle ,SYS,CLEAR  (applies to system heap and clears
  30657.                                     allocated block)
  30658. On entry    D0:  logicalSize (long word)
  30659. On exit     A0:  function result (handle)
  30660.             D0:  result code (word)
  30661.  
  30662. NewHandle attempts to allocate a new relocatable block of logicalSize bytes from the
  30663. current heap zone and then return a handle to it. The new block will be unlocked and
  30664. unpurgeable. If logicalSize bytes can’t be allocated, NewHandle returns NIL.
  30665.  
  30666. NewHandle will pursue all available avenues to create a free block of the requested
  30667. size, including compacting the heap zone, increasing its size, purging blocks from
  30668. it, and calling its grow zone function, if any.
  30669.  
  30670. Result codes    noErr         No error
  30671.                 memFullErr    Not enough room in heap zone
  30672.  
  30673. æKY NewHandleSys
  30674. æFp Memory.p
  30675. æT FUNCTION
  30676. æD FUNCTION NewHandleSys(byteCount: Size): Handle;
  30677. æDT myVariable := NewHandleSys(byteCount);
  30678. æRT 219
  30679. æC 
  30680. Trap macro  _NewHandle
  30681.             _NewHandle ,SYS        (applies to system heap)
  30682.             _NewHandle ,CLEAR      (clears allocated block)
  30683.             _NewHandle ,SYS,CLEAR  (applies to system heap and clears
  30684.                                     allocated block)
  30685. On entry    D0:  logicalSize (long word)
  30686. On exit     A0:  function result (handle)
  30687.             D0:  result code (word)
  30688.  
  30689. NewHandle attempts to allocate a new relocatable block of logicalSize bytes from the
  30690. current heap zone and then return a handle to it. The new block will be unlocked and
  30691. unpurgeable. If logicalSize bytes can’t be allocated, NewHandle returns NIL.
  30692.  
  30693. NewHandle will pursue all available avenues to create a free block of the requested
  30694. size, including compacting the heap zone, increasing its size, purging blocks from
  30695. it, and calling its grow zone function, if any.
  30696.  
  30697. Result codes    noErr         No error
  30698.                 memFullErr    Not enough room in heap zone
  30699.  
  30700. æKY NewHandleClear
  30701. æFp Memory.p
  30702. æT FUNCTION
  30703. æD FUNCTION NewHandleClear(byteCount: Size): Handle;
  30704. æDT myVariable := NewHandleClear(byteCount);
  30705. æRT 219
  30706. æC 
  30707. Trap macro  _NewHandle
  30708.             _NewHandle ,SYS        (applies to system heap)
  30709.             _NewHandle ,CLEAR      (clears allocated block)
  30710.             _NewHandle ,SYS,CLEAR  (applies to system heap and clears
  30711.                                     allocated block)
  30712. On entry    D0:  logicalSize (long word)
  30713. On exit     A0:  function result (handle)
  30714.             D0:  result code (word)
  30715.  
  30716. NewHandle attempts to allocate a new relocatable block of logicalSize bytes from the
  30717. current heap zone and then return a handle to it. The new block will be unlocked and
  30718. unpurgeable. If logicalSize bytes can’t be allocated, NewHandle returns NIL.
  30719.  
  30720. NewHandle will pursue all available avenues to create a free block of the requested
  30721. size, including compacting the heap zone, increasing its size, purging blocks from
  30722. it, and calling its grow zone function, if any.
  30723.  
  30724. Result codes    noErr         No error
  30725.                 memFullErr    Not enough room in heap zone
  30726.  
  30727. æKY NewHandleSysClear
  30728. æFp Memory.p
  30729. æT FUNCTION
  30730. æD FUNCTION NewHandleSysClear(byteCount: Size): Handle;
  30731. æDT myVariable := NewHandleSysClear(byteCount);
  30732. æRT 219
  30733. æC 
  30734. Trap macro  _NewHandle
  30735.             _NewHandle ,SYS        (applies to system heap)
  30736.             _NewHandle ,CLEAR      (clears allocated block)
  30737.             _NewHandle ,SYS,CLEAR  (applies to system heap and clears
  30738.                                     allocated block)
  30739. On entry    D0:  logicalSize (long word)
  30740. On exit     A0:  function result (handle)
  30741.             D0:  result code (word)
  30742.  
  30743. NewHandle attempts to allocate a new relocatable block of logicalSize bytes from the
  30744. current heap zone and then return a handle to it. The new block will be unlocked and
  30745. unpurgeable. If logicalSize bytes can’t be allocated, NewHandle returns NIL.
  30746.  
  30747. NewHandle will pursue all available avenues to create a free block of the requested
  30748. size, including compacting the heap zone, increasing its size, purging blocks from
  30749. it, and calling its grow zone function, if any.
  30750.  
  30751. Result codes    noErr         No error
  30752.                 memFullErr    Not enough room in heap zone
  30753.  
  30754. æKY HandleZone
  30755. æFp Memory.p
  30756. æT FUNCTION
  30757. æD FUNCTION HandleZone(h: Handle): THz;
  30758. æDT myVariable := HandleZone(h);
  30759. æRI II-34
  30760. æC 
  30761. Trap macro  _HandleZone
  30762. On entry    A0:  h (handle)
  30763. On exit     A0:  function result (pointer)
  30764.             D0:  result code (word)
  30765.  
  30766. HandleZone returns a pointer to the heap zone containing the relocatable block whose
  30767. handle is h. In case of an error, the result returned by HandleZone is undefined and
  30768. should be ignored.
  30769.  
  30770. Warning:  If handle h is empty (points to a NIL master pointer), HandleZone
  30771.           returns a pointer to the current heap zone.
  30772.  
  30773. Result codes    noErr       No error
  30774.                 memWZErr    Attempt to operate on a free block
  30775.  
  30776. æKY RecoverHandle
  30777. æFp Memory.p
  30778. æT FUNCTION
  30779. æD FUNCTION RecoverHandle(p: Ptr): Handle;
  30780. æDT myVariable := RecoverHandle(p);
  30781. æMM
  30782. æRT 23
  30783. æRI II-35, N8-1, N23-1
  30784. æC 
  30785. Trap macro  _RecoverHandle
  30786.             _RecoverHandle ,SYS  (applies to system heap)
  30787. On entry    A0:  p (pointer)
  30788. On exit     A0:  function result (handle)
  30789.             D0:  unchanged
  30790.  
  30791. RecoverHandle returns a handle to the relocatable block pointed to by p.
  30792.  
  30793. Assembly-language note:  The trap _RecoverHandle doesn’t return a result
  30794.                          code in register D0; the previous contents of D0
  30795.                          are preserved unchanged.
  30796.  
  30797. Result codes    noErr    No error [Pascal only]
  30798.  
  30799. æKY NewPtr
  30800. æFp Memory.p
  30801. æT FUNCTION
  30802. æD FUNCTION NewPtr(byteCount: Size): Ptr;
  30803. æDT myVariable := NewPtr(byteCount);
  30804. æMM
  30805. æRI I-75, 79, II-36, P-51, 177
  30806. æC 
  30807. Trap macro  _NewPtr
  30808.             _NewPtr ,SYS        (applies to system heap)
  30809.             _NewPtr ,CLEAR      (clears allocated block)
  30810.             _NewPtr ,SYS,CLEAR  (applies to system heap and clears
  30811.                                  allocated block)
  30812. On entry    D0:  logicalSize (long word)
  30813. On exit     A0:  function result (pointer)
  30814.             D0:  result code (word)
  30815.  
  30816. NewPtr attempts to allocate a new nonrelocatable block of logicalSize bytes from the
  30817. current heap zone and then return a pointer to it. If logicalSize bytes can’t be
  30818. allocated, NewPtr returns NIL.
  30819.  
  30820. NewPtr will pursue all available avenues to create a free block of the requested size
  30821. at the lowest possible location in the heap zone, including compacting the heap zone,
  30822. increasing its size, purging blocks from it, and calling its grow zone function, if
  30823. any.
  30824.  
  30825. Result codes    noErr         No error
  30826.                 memFullErr    Not enough room in heap zone
  30827.  
  30828. æKY NewPtrSys
  30829. æFp Memory.p
  30830. æT FUNCTION
  30831. æD FUNCTION NewPtrSys(byteCount: Size): Ptr;
  30832. æDT myVariable := NewPtrSys(byteCount);
  30833. æRT 219
  30834. æC 
  30835. Trap macro  _NewPtr
  30836.             _NewPtr ,SYS        (applies to system heap)
  30837.             _NewPtr ,CLEAR      (clears allocated block)
  30838.             _NewPtr ,SYS,CLEAR  (applies to system heap and clears
  30839.                                  allocated block)
  30840. On entry    D0:  logicalSize (long word)
  30841. On exit     A0:  function result (pointer)
  30842.             D0:  result code (word)
  30843.  
  30844. NewPtr attempts to allocate a new nonrelocatable block of logicalSize bytes from the
  30845. current heap zone and then return a pointer to it. If logicalSize bytes can’t be
  30846. allocated, NewPtr returns NIL.
  30847.  
  30848. NewPtr will pursue all available avenues to create a free block of the requested size
  30849. at the lowest possible location in the heap zone, including compacting the heap zone,
  30850. increasing its size, purging blocks from it, and calling its grow zone function, if
  30851. any.
  30852.  
  30853. Result codes    noErr         No error
  30854.                 memFullErr    Not enough room in heap zone
  30855.  
  30856. æKY NewPtrClear
  30857. æFp Memory.p
  30858. æT FUNCTION
  30859. æD FUNCTION NewPtrClear(byteCount: Size): Ptr;
  30860. æDT myVariable := NewPtrClear(byteCount);
  30861. æRT 219
  30862. æC 
  30863. Trap macro  _NewPtr
  30864.             _NewPtr ,SYS        (applies to system heap)
  30865.             _NewPtr ,CLEAR      (clears allocated block)
  30866.             _NewPtr ,SYS,CLEAR  (applies to system heap and clears
  30867.                                  allocated block)
  30868. On entry    D0:  logicalSize (long word)
  30869. On exit     A0:  function result (pointer)
  30870.             D0:  result code (word)
  30871.  
  30872. NewPtr attempts to allocate a new nonrelocatable block of logicalSize bytes from the
  30873. current heap zone and then return a pointer to it. If logicalSize bytes can’t be
  30874. allocated, NewPtr returns NIL.
  30875.  
  30876. NewPtr will pursue all available avenues to create a free block of the requested size
  30877. at the lowest possible location in the heap zone, including compacting the heap zone,
  30878. increasing its size, purging blocks from it, and calling its grow zone function, if
  30879. any.
  30880.  
  30881. Result codes    noErr         No error
  30882.                 memFullErr    Not enough room in heap zone
  30883.  
  30884. æKY NewPtrSysClear
  30885. æFp Memory.p
  30886. æT FUNCTION
  30887. æD FUNCTION NewPtrSysClear(byteCount: Size): Ptr;
  30888. æDT myVariable := NewPtrSysClear(byteCount);
  30889. æRT 219
  30890. æC 
  30891. Trap macro  _NewPtr
  30892.             _NewPtr ,SYS        (applies to system heap)
  30893.             _NewPtr ,CLEAR      (clears allocated block)
  30894.             _NewPtr ,SYS,CLEAR  (applies to system heap and clears
  30895.                                  allocated block)
  30896. On entry    D0:  logicalSize (long word)
  30897. On exit     A0:  function result (pointer)
  30898.             D0:  result code (word)
  30899.  
  30900. NewPtr attempts to allocate a new nonrelocatable block of logicalSize bytes from the
  30901. current heap zone and then return a pointer to it. If logicalSize bytes can’t be
  30902. allocated, NewPtr returns NIL.
  30903.  
  30904. NewPtr will pursue all available avenues to create a free block of the requested size
  30905. at the lowest possible location in the heap zone, including compacting the heap zone,
  30906. increasing its size, purging blocks from it, and calling its grow zone function, if
  30907. any.
  30908.  
  30909. Result codes    noErr         No error
  30910.                 memFullErr    Not enough room in heap zone
  30911.  
  30912. æKY PtrZone
  30913. æFp Memory.p
  30914. æT FUNCTION
  30915. æD FUNCTION PtrZone(p: Ptr): THz;
  30916. æDT myVariable := PtrZone(p);
  30917. æRI II-38
  30918. æC 
  30919. Trap macro  _PtrZone
  30920. On entry    A0:  p (pointer)
  30921. On exit     A0:  function result (pointer)
  30922.             D0:  result code (word)
  30923.  
  30924. PtrZone returns a pointer to the heap zone containing the nonrelocatable block pointed
  30925. to by p. In case of an error, the result returned by PtrZone is undefined and should
  30926. be ignored.
  30927.  
  30928. Result codes    noErr       No error
  30929.                 memWZErr    Attempt to operate on a free block
  30930.  
  30931. æKY GZSaveHnd
  30932. æFp Memory.p
  30933. æT FUNCTION
  30934. æD FUNCTION GZSaveHnd: Handle;
  30935.     INLINE $2EB8,$0328;
  30936. æDT myVariable := GZSaveHnd(paramList);
  30937. æRI II-43
  30938. æC  
  30939. GZSaveHnd returns a handle to a relocatable block that must not be moved by the grow
  30940. zone function, or NIL if there is no such block. Your grow zone function must be sure
  30941. to call GZSaveHnd; if a handle is returned, it must ensure that this block is not
  30942. moved.
  30943.  
  30944. Assembly-language note:  You can find the same handle in the global
  30945.                          variable GZRootHnd.
  30946.  
  30947. æKY TopMem
  30948. æFp Memory.p
  30949. æT FUNCTION
  30950. æD FUNCTION TopMem: Ptr;
  30951.     INLINE $2EB8,$0108;
  30952. æDT myVariable := TopMem(paramList);
  30953. æRI II-44
  30954. æC  
  30955. [Not in ROM]
  30956.  
  30957. On a Macintosh 128K or 512K, TopMem returns a pointer to the end of RAM; on the
  30958. Macintosh XL, it returns a pointer to the end of the memory available for use by the
  30959. application.
  30960.  
  30961. Assembly-language note:  This value is stored in the global variable MemTop.
  30962.  
  30963. æKY MaxBlock
  30964. æFp Memory.p
  30965. æT FUNCTION
  30966. æD FUNCTION MaxBlock: LONGINT;
  30967. æDT myVariable := MaxBlock(paramList);
  30968. æRI IV-77
  30969. æC 
  30970. Trap macro  _MaxBlock
  30971.             _MaxBlock ,SYS    (applies to system heap)
  30972. On exit     D0:  function result (word)
  30973.  
  30974. MaxBlock returns the maximum contiguous space in bytes that could be obtained by
  30975. compacting the current zone (without actually doing the compaction).
  30976.  
  30977. æKY StackSpace
  30978. æFp Memory.p
  30979. æT FUNCTION
  30980. æD FUNCTION StackSpace: LONGINT;
  30981. æDT myVariable := StackSpace(paramList);
  30982. æRI IV-78
  30983. æC 
  30984. Trap macro  _StackSpace
  30985. On exit     D0:  function result (word)
  30986.  
  30987. StackSpace returns the current amount of stack space between the current stack pointer
  30988. and the application heap (at the instant of return from the trap).
  30989.  
  30990. æKY NewEmptyHandle
  30991. æFp Memory.p
  30992. æT FUNCTION
  30993. æD FUNCTION NewEmptyHandle: Handle;
  30994. æDT myVariable := NewEmptyHandle(paramList);
  30995. æMM
  30996. æRI IV-78
  30997. æC 
  30998. Trap macro  _NewEmptyHandle
  30999.             _NewEmptyHandle ,SYS    (applies to system heap)
  31000. On exit     A0:  function result (handle)
  31001.             D0:  result code (word)
  31002.  
  31003. NewEmptyHandle is similar in function to NewHandle except that it does not allocate
  31004. any space; the handle returned is empty (in other words, it points to a NIL master
  31005. pointer). NewEmptyHandle is used extensively by the Resource Manager; you may not
  31006. need to use it.
  31007.  
  31008. æKY HLock
  31009. æFp Memory.p
  31010. æT PROCEDURE
  31011. æD PROCEDURE HLock(h: Handle);
  31012. æDT HLock(h);
  31013. æRT 2
  31014. æRI II-41, N2-3
  31015. æC 
  31016. The master pointer associated with each handle contains flags for use by the Memory
  31017. Manager. Routines are provided for setting and clearing each of these flags, as well
  31018. as for saving and restoring the entire byte.
  31019.  
  31020. Warning:  Failure to use these routines virtually guarantees incompatibility
  31021.           with future versions of the Macintosh. You should not set and clear
  31022.           these flags directly.
  31023.  
  31024. The HLock and HUnlock procedures lock and unlock a given relocatable block by setting
  31025. and clearing the lock flag. The HPurge and HNoPurge mark a given relocatable block as
  31026. purgeable or unpurgeable by setting and clearing the purge flag.
  31027.  
  31028. A third flag, the resource flag, is used internally by the Resource Manager. The
  31029. HSetRBit and HClrRBit procedures set and clear this flag.
  31030. The HSetState and HGetState routines let you save and restore the state of the flags
  31031. byte.
  31032.  
  31033. PROCEDURE HLock (h:  Handle);
  31034.  
  31035. Trap macro  _HLock
  31036. On entry    A0:  h (handle)
  31037. On exit     D0:  result code (word)
  31038.  
  31039. HLock locks a relocatable block, preventing it from being moved within its heap zone.
  31040. If the block is already locked, HLock does nothing.
  31041.  
  31042. Warning:  To prevent heap fragmentation, you should always call MoveHHi
  31043.           before locking a relocatable block.
  31044.  
  31045. Result codes    noErr           No error
  31046.                 nilHandleErr    NIL master pointer
  31047.                 memWZErr        Attempt to operate on a free block
  31048.  
  31049. æKY HUnlock
  31050. æFp Memory.p
  31051. æT PROCEDURE
  31052. æD PROCEDURE HUnlock(h: Handle);
  31053. æDT HUnlock(h);
  31054. æRT 2
  31055. æRI II-41, N2-3
  31056. æC 
  31057. The master pointer associated with each handle contains flags for use by the Memory
  31058. Manager. Routines are provided for setting and clearing each of these flags, as well
  31059. as for saving and restoring the entire byte.
  31060.  
  31061. Warning:  Failure to use these routines virtually guarantees incompatibility
  31062.           with future versions of the Macintosh. You should not set and clear
  31063.           these flags directly.
  31064.  
  31065. The HLock and HUnlock procedures lock and unlock a given relocatable block by setting
  31066. and clearing the lock flag. The HPurge and HNoPurge mark a given relocatable block as
  31067. purgeable or unpurgeable by setting and clearing the purge flag.
  31068.  
  31069. A third flag, the resource flag, is used internally by the Resource Manager. The
  31070. HSetRBit and HClrRBit procedures set and clear this flag.
  31071. The HSetState and HGetState routines let you save and restore the state of the flags
  31072. byte.
  31073.  
  31074. PROCEDURE HUnlock (h:  Handle);
  31075.  
  31076. Trap macro  _HUnlock
  31077. On entry    A0:  h (handle)
  31078. On exit     D0:  result code (word)
  31079.  
  31080. HUnlock unlocks a relocatable block, allowing it to be moved within its heap zone. If
  31081. the block is already unlocked, HUnlock does nothing.
  31082.  
  31083. Result codes    noErr           No error
  31084.                 nilHandleErr    NIL master pointer
  31085.                 memWZErr        Attempt to operate on a free block
  31086.  
  31087. æKY HPurge
  31088. æFp Memory.p
  31089. æT PROCEDURE
  31090. æD PROCEDURE HPurge(h: Handle);
  31091. æDT HPurge(h);
  31092. æRT 2
  31093. æRI II-41
  31094. æC 
  31095. Trap macro  _HPurge
  31096. On entry    A0:  h (handle)
  31097. On exit     D0:  result code (word)
  31098.  
  31099. HPurge marks a relocatable block as purgeable. If the block is already purgeable,
  31100. HPurge does nothing.
  31101.  
  31102. Note:  If you call HPurge on a locked block, it won’t unlock the block, but
  31103.        it will mark the block as purgeable. If you later call HUnlock, the
  31104.        block will be subject to purging.
  31105.  
  31106. Result codes    noErr           No error
  31107.                 nilHandleErr    NIL master pointer
  31108.                 memWZErr        Attempt to operate on a free block
  31109.  
  31110. æKY HNoPurge
  31111. æFp Memory.p
  31112. æT PROCEDURE
  31113. æD PROCEDURE HNoPurge(h: Handle);
  31114. æDT HNoPurge(h);
  31115. æRT 2
  31116. æRI II-42, N2-3
  31117. æC 
  31118. Trap macro  _HNoPurge
  31119. On entry    A0:  h (handle)
  31120. On exit     D0:  result code (word)
  31121.  
  31122. HNoPurge marks a relocatable block as unpurgeable. If the block is already unpurgeable,
  31123. HNoPurge does nothing.
  31124.  
  31125. Result codes    noErr           No error
  31126.                 nilHandleErr    NIL master pointer
  31127.                 memWZErr        Attempt to operate on a free block
  31128.  
  31129. æKY StripAddress
  31130. æFp Memory.p
  31131. æT FUNCTION
  31132. æD FUNCTION StripAddress(theAddress: Ptr): Ptr;
  31133. æDT myVariable := StripAddress(theAddress);
  31134. æRT 212,213
  31135. æRI V-593
  31136. æC 
  31137. Trap macro  _StripAddress
  31138. On entry    D0:  theAddress (pointer)
  31139. On exit     D0:  function result (pointer)
  31140.  
  31141. The original description of StripAddress was incorrect.  Technical Note #213 correctly
  31142. documents this function.
  31143.  
  31144. •••Refer to Technical Note #213:•••
  31145.  
  31146. æKY MFMaxMem
  31147. æFp Memory.p
  31148. æT FUNCTION
  31149. æTN A88F
  31150. æD FUNCTION MFMaxMem(VAR grow: Size): Size;
  31151.     INLINE $3F3C,$0015,$A88F;
  31152. æDT myVariable := MFMaxMem(grow);
  31153. æC 
  31154.  
  31155. æKY MFFreeMem
  31156. æFp Memory.p
  31157. æT FUNCTION
  31158. æTN A88F
  31159. æD FUNCTION MFFreeMem: LONGINT;
  31160.     INLINE $3F3C,$0018,$A88F;
  31161. æDT myVariable := MFFreeMem(paramList);
  31162. æC 
  31163.  
  31164. æKY MFTempNewHandle
  31165. æFp Memory.p
  31166. æT FUNCTION
  31167. æTN A88F
  31168. æD FUNCTION MFTempNewHandle(logicalSize: Size;VAR resultCode: OSErr): Handle;
  31169.     INLINE $3F3C,$001D,$A88F;
  31170. æDT myVariable := MFTempNewHandle(logicalSize,resultCode);
  31171. æRT 205
  31172. æC 
  31173.  
  31174. æKY MFTempHLock
  31175. æFp Memory.p
  31176. æT PROCEDURE
  31177. æTN A88F
  31178. æD PROCEDURE MFTempHLock(h: Handle;VAR resultCode: OSErr);
  31179.     INLINE $3F3C,$001E,$A88F;
  31180. æDT MFTempHLock(h,resultCode);
  31181. æC 
  31182.  
  31183. æKY MFTempHUnlock
  31184. æFp Memory.p
  31185. æT PROCEDURE
  31186. æTN A88F
  31187. æD PROCEDURE MFTempHUnlock(h: Handle;VAR resultCode: OSErr);
  31188.     INLINE $3F3C,$001F,$A88F;
  31189. æDT MFTempHUnlock(h,resultCode);
  31190. æC 
  31191.  
  31192. æKY MFTempDisposHandle
  31193. æFp Memory.p
  31194. æT PROCEDURE
  31195. æTN A88F
  31196. æD PROCEDURE MFTempDisposHandle(h: Handle;VAR resultCode: OSErr);
  31197.     INLINE $3F3C,$0020,$A88F;
  31198. æDT MFTempDisposHandle(h,resultCode);
  31199. æC 
  31200.  
  31201. æKY MFTopMem
  31202. æFp Memory.p
  31203. æT FUNCTION
  31204. æTN A88F
  31205. æD FUNCTION MFTopMem: Ptr;
  31206.     INLINE $3F3C,$0016,$A88F;
  31207. æDT myVariable := MFTopMem(paramList);
  31208. æC 
  31209.  
  31210. æKY InitApplZone
  31211. æFp Memory.p
  31212. æT PROCEDURE
  31213. æTN A02C
  31214. æD PROCEDURE InitApplZone;
  31215.     INLINE $A02C;
  31216. æDT InitApplZone(paramList);
  31217. æMM
  31218. æRI II-28, N64-2
  31219. æC 
  31220. Trap macro   _InitApplZone
  31221. On exit      D0:  result code (word)
  31222.  
  31223. InitApplZone initializes the application heap zone and makes it the current zone. The
  31224. contents of any previous application zone are lost; all previously existing blocks in
  31225. that zone are discarded. The zone’s grow zone function is set to NIL. InitApplZone is
  31226. called by the Segment Loader when starting up an application; you shouldn’t normally
  31227. need to call it.
  31228.  
  31229. Warning:  Reinitializing the application zone from within a running program
  31230.           is tricky, since the program’s code itself normally resides in the
  31231.           application zone. To do it safely, the code containing the
  31232.           InitApplZone call cannot be in the application zone.
  31233.  
  31234. Result codes    noErr    No error
  31235.  
  31236. æKY InitZone
  31237. æFp Memory.p
  31238. æT PROCEDURE
  31239. æD PROCEDURE InitZone(pgrowZone: ProcPtr;cmoreMasters: INTEGER;limitPtr: Ptr;
  31240.     startPtr: Ptr);
  31241. æDT InitZone(pgrowZone,cmoreMasters,limitPtr,startPtr);
  31242. æMM
  31243. æRI II-29
  31244. æC 
  31245. Trap macro  _InitZone
  31246. On entry    A0:    pointer to parameter block
  31247.  
  31248. Parameter block
  31249.     0    startPtr      pointer
  31250.     4    limitPtr      pointer
  31251.     8    cMoreMasters  word
  31252.     10   pGrowZone     pointer
  31253.  
  31254. On exit     D0:    result code (word)
  31255.  
  31256. InitZone creates a new heap zone, initializes its header and trailer, and makes it
  31257. the current zone. The startPtr parameter is a pointer to the first byte of the new
  31258. zone; limitPtr points to the first byte beyond the end of the zone. The new zone will
  31259. occupy memory addresses from ORD(startPtr) through
  31260. ORD(limitPtr)–1.
  31261.  
  31262. CMoreMasters tells how many master pointers should be allocated at a time for the new
  31263. zone. This number of master pointers are created initially; should more be needed
  31264. later, they’ll be added in increments of this same number.
  31265.  
  31266. The pGrowZone parameter is a pointer to the grow zone function for the new zone, if
  31267. any. If you’re not defining a grow zone function for this zone, pass NIL.
  31268.  
  31269. The new zone includes a 52-byte header and a 12-byte trailer, so its actual usable
  31270. space runs from ORD(startPtr)+52 through ORD(limitPtr)–13. In addition, there’s an
  31271. eight-byte header for the master pointer block, as well as four bytes for each master
  31272. pointer, within this usable area. Thus the total available space in the zone, in
  31273. bytes, is initially
  31274.  
  31275.   ORD(limitPtr) – ORD(startPtr) – 64 – (8 + (4*cMoreMasters))
  31276.  
  31277. This number must not be less than 0. Note that the amount of available space in the
  31278. zone will decrease as more master pointers are allocated.
  31279.  
  31280. Result codes    noErr    No error
  31281.  
  31282. æKY SetZone
  31283. æFp Memory.p
  31284. æT PROCEDURE
  31285. æD PROCEDURE SetZone(hz: THz);
  31286. æDT SetZone(hz);
  31287. æRI II-31, N8-1
  31288. æC 
  31289. Trap macro  _SetZone
  31290. On entry    A0:  hz (pointer)
  31291. On exit     D0:  result code (word)
  31292.  
  31293. SetZone sets the current heap zone to the zone pointed to by hz.
  31294.  
  31295. Assembly-language note:  You can set the current heap zone by storing
  31296.                          a pointer to it in the global variable TheZone.
  31297.  
  31298. Result codes    noErr    No error
  31299.  
  31300. æKY CompactMem
  31301. æFp Memory.p
  31302. æT FUNCTION
  31303. æD FUNCTION CompactMem(cbNeeded: Size): Size;
  31304. æDT myVariable := CompactMem(cbNeeded);
  31305. æMM
  31306. æRT 51
  31307. æRI II-39, N51-1
  31308. æC 
  31309. Trap macro  _CompactMem
  31310.             _CompactMem ,SYS (applies to system heap)
  31311. On entry    D0:  cbNeeded (long word)
  31312. On exit     D0:  function result (long word)
  31313.  
  31314. CompactMem compacts the current heap zone by moving relocatable blocks down and
  31315. collecting free space together until a contiguous block of at least cbNeeded free
  31316. bytes is found or the entire zone is compacted; it doesn’t purge any purgeable blocks.
  31317. CompactMem returns the size in bytes of the largest contiguous free block remaining.
  31318. Note that it doesn’t actually allocate the block.
  31319.  
  31320. Result codes    noErr    No error [Pascal only]
  31321.  
  31322. æKY PurgeMem
  31323. æFp Memory.p
  31324. æT PROCEDURE
  31325. æD PROCEDURE PurgeMem(cbNeeded: Size);
  31326. æDT PurgeMem(cbNeeded);
  31327. æMM
  31328. æRT 51
  31329. æRI II-40, N51-1
  31330. æC 
  31331. Trap macro  _PurgeMem
  31332.             _PurgeMem ,SYS (applies to system heap)
  31333. On entry    D0:  cbNeeded (long word)
  31334. On exit     D0:  result code (word)
  31335.  
  31336. PurgeMem sequentially purges blocks from the current heap zone until a contiguous
  31337. block of at least cbNeeded free bytes is created or the entire zone is purged; it
  31338. doesn’t compact the heap zone. Only relocatable, unlocked, purgeable blocks can be
  31339. purged. Note that PurgeMem doesn’t actually allocate the block.
  31340.  
  31341. Result codes    noErr         No error
  31342.                 memFullErr    Not enough room in heap zone
  31343.  
  31344. æKY FreeMem
  31345. æFp Memory.p
  31346. æT FUNCTION
  31347. æD FUNCTION FreeMem: LONGINT;
  31348. æDT myVariable := FreeMem(paramList);
  31349. æMM
  31350. æRI II-38
  31351. æC 
  31352. Trap macro  _FreeMem
  31353.             _FreeMem ,SYS (applies to system heap)
  31354. On exit     D0:  function result (long word)
  31355.  
  31356. FreeMem returns the total amount of free space in the current heap zone, in bytes.
  31357. Note that it usually isn’t possible to allocate a block of this size, because of
  31358. fragmentation due to nonrelocatable or locked blocks.
  31359.  
  31360. Result codes    noErr    No error [Pascal only]
  31361.  
  31362. æKY ResrvMem
  31363. æFp Memory.p
  31364. æT PROCEDURE
  31365. æD PROCEDURE ResrvMem(cbNeeded: Size);
  31366. æDT ResrvMem(cbNeeded);
  31367. æMM
  31368. æRI II-39
  31369. æC 
  31370. Trap macro  _ResrvMem
  31371.             _ResrvMem ,SYS (applies to system heap)
  31372. On entry    D0:  cbNeeded (long word)
  31373. On exit     D0:  result code (word)
  31374.  
  31375. ResrvMem creates free space for a block of cbNeeded contiguous bytes at the lowest
  31376. possible position in the current heap zone. It will try every available means to
  31377. place the block as close as possible to the bottom of the zone, including moving
  31378. other blocks upward, expanding the zone, or purging blocks from it. Note that ResrvMem
  31379. doesn’t actually allocate the block.
  31380.  
  31381. Note:  When you allocate a relocatable block that you know will be locked for
  31382.        long periods of time, call ResrvMem first. This reserves space for the
  31383.        block near the bottom of the heap zone, where it will interfere with
  31384.        compaction as little as possible. It isn’t necessary to call ResrvMem
  31385.        for a nonrelocatable block; NewPtr calls it automatically. It’s also
  31386.        called automatically when locked resources are read into memory.
  31387.  
  31388. Result codes    noErr         No error
  31389.                 memFullErr    Not enough room in heap zone
  31390.  
  31391. æKY MaxMem
  31392. æFp Memory.p
  31393. æT FUNCTION
  31394. æD FUNCTION MaxMem(VAR grow: Size): Size;
  31395. æDT myVariable := MaxMem(grow);
  31396. æRI II-38
  31397. æC 
  31398. Trap macro  _MaxMem
  31399.             _MaxMem ,SYS (applies to system heap)
  31400. On exit     D0:  function result (long word)
  31401.             A0:  grow (long word)
  31402.  
  31403. MaxMem compacts the current heap zone and purges all purgeable blocks from the zone.
  31404. It returns as its result the size in bytes of the largest contiguous free block in
  31405. the zone after the compaction. If the current zone is the original application heap
  31406. zone, the grow parameter is set to the maximum number of bytes by which the zone can
  31407. grow. For any other heap zone, grow is set to 0. MaxMem doesn’t actually expand the
  31408. zone or call its grow zone function.
  31409.  
  31410. Result codes    noErr    No error [Pascal only]
  31411.  
  31412. æKY SetGrowZone
  31413. æFp Memory.p
  31414. æT PROCEDURE
  31415. æD PROCEDURE SetGrowZone(growZone: ProcPtr);
  31416. æDT SetGrowZone(growZone);
  31417. æRI II-42
  31418. æC 
  31419. Trap macro  _SetGrowZone
  31420. On entry    A0:  growZone (pointer)
  31421. On exit     D0:  result code (word)
  31422.  
  31423. SetGrowZone sets the current heap zone’s grow zone function as designated by the
  31424. growZone parameter. A NIL parameter value removes any grow zone function the zone may
  31425. previously have had.
  31426.  
  31427. Note:  If your program presses the limits of the available heap space, it’s
  31428.        a good idea to have a grow zone function of some sort. At the very
  31429.        least, the grow zone function should take some graceful action—such
  31430.        as displaying an alert box with the message “Out of memory”—instead
  31431.       of just failing unpredictably.
  31432.  
  31433. If it has failed to create a block of the needed size after compacting the zone,
  31434. increasing its size (in the case of the original application zone), and purging
  31435. blocks from it, the Memory Manager calls the grow zone function as a last resort.
  31436.  
  31437. The grow zone function should be of the form
  31438.  
  31439. FUNCTION MyGrowZone (cbNeeded:  Size) :  LONGINT;
  31440.  
  31441. The cbNeeded parameter gives the physical size of the needed block in bytes, including
  31442. the block header. The grow zone function should attempt to create a free block of at
  31443. least this size. It should return a nonzero number if it’s able to allocate some
  31444. memory, or 0 if it’s not able to allocate any.
  31445.  
  31446. If the grow zone function returns 0, the Memory Manager will give up trying to allocate
  31447. the needed block and will signal failure with the result code memFullErr. Otherwise
  31448. it will compact the heap zone and try again to allocate the block. If still unsuccessful,
  31449. it will continue to call the grow zone function repeatedly, compacting the zone again
  31450. after each call, until it either succeeds in allocating the needed block or receives
  31451. a zero result and gives up.
  31452.  
  31453. The usual way for the grow zone function to free more space is to call EmptyHandle to
  31454. purge blocks that were previously marked unpurgeable. Another possibility is to
  31455. unlock blocks that were previously locked
  31456.  
  31457. Note:  Although just unlocking blocks doesn’t actually free any additional
  31458.        space in the zone, the grow zone function should still return a nonzero
  31459.        result in this case. This signals the Memory Manager to compact the
  31460.        heap and try again to allocate the needed block.
  31461.  
  31462. Warning:  Depending on the circumstances in which the grow zone function is
  31463.           called, there may be a particular block within the heap zone that
  31464.           must not be moved. For this reason, it’s essential that your grow
  31465.           zone function call the function GZSaveHnd (see below).
  31466.  
  31467. Result codes    noErr    No error
  31468.  
  31469. æKY SetApplLimit
  31470. æFp Memory.p
  31471. æT PROCEDURE
  31472. æD PROCEDURE SetApplLimit(zoneLimit: Ptr);
  31473. æDT SetApplLimit(zoneLimit);
  31474. æRI II-30
  31475. æC 
  31476. Trap macro  _SetApplLimit
  31477. On entry    A0:  zoneLimit (pointer)
  31478. On exit     D0:  result code (word)
  31479.  
  31480. SetApplLimit sets the application heap limit, beyond which the application heap can’t
  31481. be expanded. The actual expansion isn’t under your program’s control, but is done
  31482. automatically by the Memory Manager when necessary to satisfy allocation requests.
  31483. Only the original application zone can be expanded.
  31484.  
  31485. ZoneLimit is a pointer to a byte in memory beyond which the zone will not be allowed
  31486. to grow. The zone can grow to include the byte preceding zoneLimit in memory, but no
  31487. farther. If the zone already extends beyond the specified limit it won’t be cut back,
  31488. but it will be prevented from growing any more.
  31489.  
  31490. Warning:  Notice that zoneLimit is not a byte count. To limit the application
  31491.           zone to a particular size (say 8K bytes), you have to write something
  31492.           like
  31493.  
  31494.             SetApplLimit(Ptr(ApplicZone)+8192)
  31495.  
  31496. The Memory Manager function ApplicZone is explained below.
  31497.  
  31498. Assembly-language note:  You can just store the new application heap
  31499.                          limit in the global variable ApplLimit.
  31500.  
  31501. Result codes    noErr         No error
  31502.                 memFullErr    Not enough room in heap zone
  31503.  
  31504. æKY MoveHHi
  31505. æFp Memory.p
  31506. æT PROCEDURE
  31507. æD PROCEDURE MoveHHi(h: Handle);
  31508. æDT MoveHHi(h);
  31509. æMM
  31510. æRT 103, 111
  31511. æRI II-44, IV-77, 83, N103, N111
  31512. æC 
  31513. [Not in 64K ROM]
  31514.  
  31515. Trap macro  _MoveHHi
  31516. On entry    A0:  h (handle)
  31517. On exit     D0:  result code (word)
  31518.  
  31519. MoveHHi moves the relocatable block whose handle is h toward the top of the current
  31520. heap zone, until the block hits either a nonrelocatable block, a locked relocatable
  31521. block, or the last block in the current heap zone. By calling MoveHHi before you lock
  31522. a relocatable block, you can avoid fragmentation of the heap, as well as make room
  31523. for future pointers as low in the heap as possible.
  31524.  
  31525. Result codes    noErr           No error
  31526.                 nilHandleErr    NIL master pointer
  31527.                 memLockedErr    Block is locked
  31528.  
  31529. æKY DisposPtr
  31530. æFp Memory.p
  31531. æT PROCEDURE
  31532. æD PROCEDURE DisposPtr(p: Ptr);
  31533. æDT DisposPtr(p);
  31534. æMM
  31535. æRI I-75, 79, II-36, P-51, 169
  31536. æC 
  31537. Trap macro  _DisposPtr
  31538. On entry    A0:  p (pointer)
  31539. On exit     D0:  result code (word)
  31540.  
  31541. DisposPtr releases the memory occupied by the nonrelocatable block pointed to by
  31542. p.
  31543.  
  31544. Warning:  After a call to DisposPtr, all pointers to the released block
  31545.           become invalid and should not be used again. Any subsequent calls
  31546.           to DisposPtr using an invalid pointer will damage the master
  31547.           pointer list.
  31548.  
  31549. Result codes    noErr       No error
  31550.                 memWZErr    Attempt to operate on a free block
  31551.  
  31552. æKY GetPtrSize
  31553. æFp Memory.p
  31554. æT FUNCTION
  31555. æD FUNCTION GetPtrSize(p: Ptr): Size;
  31556. æDT myVariable := GetPtrSize(p);
  31557. æRI II-37
  31558. æC 
  31559. Trap macro  _GetPtrSize
  31560. On entry    A0:    p (pointer)
  31561. On exit     D0:    if >= 0, function result (long word)
  31562.                    if < 0, result code (word)
  31563.  
  31564. GetPtrSize returns the logical size, in bytes, of the nonrelocatable block pointed to
  31565. by p. In case of an error, GetPtrSize returns 0.
  31566.  
  31567. Assembly-language note:  Recall that the trap dispatcher sets the condition
  31568.                          codes before returning from a trap by testing the
  31569.                          low-order word of register D0 with a TST.W instruction.
  31570.                          Since the block size returned in D0 by _GetPtrSize is
  31571.                          a full 32-bit long word, the word-length test sets the
  31572.                          condition codes incorrectly in this case. To branch on
  31573.                          the contents of D0, use your own TST.L instruction on
  31574.                          return from the trap to test the full 32 bits of the
  31575.                          register.
  31576.  
  31577. Result codes    noErr       No error [Pascal only]
  31578.                 memWZErr    Attempt to operate on a free block
  31579.  
  31580. æKY SetPtrSize
  31581. æFp Memory.p
  31582. æT PROCEDURE
  31583. æD PROCEDURE SetPtrSize(p: Ptr;newSize: Size);
  31584. æDT SetPtrSize(p,newSize);
  31585. æMM
  31586. æRI II-37
  31587. æC 
  31588. Trap macro  _SetPtrSize
  31589. On entry    A0:  p (pointer)
  31590.             D0:  newSize (long word)
  31591. On exit     D0:  result code (word)
  31592.  
  31593. SetPtrSize changes the logical size of the nonrelocatable block pointed to by p to
  31594. newSize bytes.
  31595.  
  31596. Result codes    noErr         No error
  31597.                 memFullErr    Not enough room in heap zone
  31598.                 memWZErr      Attempt to operate on a free block
  31599.  
  31600. æKY DisposHandle
  31601. æFp Memory.p
  31602. æT PROCEDURE
  31603. æD PROCEDURE DisposHandle(h: Handle);
  31604. æDT DisposHandle(h);
  31605. æMM
  31606. æRI I-76, 80, II-33, N8-1, P-51, 168
  31607. æC 
  31608. Trap macro  _DisposHandle
  31609. On entry    A0:  h (handle)
  31610. On exit     D0:  result code (word)
  31611.  
  31612. DisposHandle releases the memory occupied by the relocatable block whose handle is
  31613. h.
  31614.  
  31615. Warning:  After a call to DisposHandle, all handles to the released block
  31616.           become invalid and should not be used again. Any subsequent calls
  31617.           to DisposHandle using an invalid handle will damage the master
  31618.           pointer list.
  31619.  
  31620. Result codes    noErr       No error
  31621.                 memWZErr    Attempt to operate on a free block
  31622.  
  31623. æKY GetHandleSize
  31624. æFp Memory.p
  31625. æT FUNCTION
  31626. æD FUNCTION GetHandleSize(h: Handle): Size;
  31627. æDT myVariable := GetHandleSize(h);
  31628. æRI II-33, N54-1, N63-1
  31629. æC 
  31630. Trap macro  _GetHandleSize
  31631. On entry    A0:    h (handle)
  31632. On exit     D0:    if >= 0, function result (long word)
  31633.                    if < 0, result code (word)
  31634.  
  31635. GetHandleSize returns the logical size, in bytes, of the relocatable block whose
  31636. handle is h. In case of an error, GetHandleSize returns 0.
  31637.  
  31638. Assembly-language note:  Recall that the trap dispatcher sets the condition
  31639.                          codes before returning from a trap by testing the
  31640.                          low-order word of register D0 with a TST.W instruction.
  31641.                          Since the block size returned in D0 by _GetHandleSize
  31642.                          is a full 32-bit long word, the word-length test sets
  31643.                          the condition codes incorrectly in this case. To
  31644.                          branch on the contents of D0, use your own TST.L
  31645.                          instruction on return from the trap to test the full
  31646.                          32 bits of the register.
  31647.  
  31648. Result codes    noErr           No error [Pascal only]
  31649.                 nilHandleErr    NIL master pointer
  31650.                 memWZErr        Attempt to operate on a free block
  31651.  
  31652. æKY SetHandleSize
  31653. æFp Memory.p
  31654. æT PROCEDURE
  31655. æD PROCEDURE SetHandleSize(h: Handle;newSize: Size);
  31656. æDT SetHandleSize(h,newSize);
  31657. æMM
  31658. æRI II-34
  31659. æC 
  31660. Trap macro  _SetHandleSize
  31661. On entry    A0:  h (handle)
  31662.             D0:  newSize (long word)
  31663. On exit     D0:  result code (word)
  31664.  
  31665. SetHandleSize changes the logical size of the relocatable block whose handle is h to
  31666. newSize bytes.
  31667.  
  31668. Note:  Be prepared for an attempt to increase the size of a locked block to
  31669.        fail, since there may be a block above it that’s either nonrelocatable
  31670.        or locked.
  31671.  
  31672. Result codes    noErr           No error
  31673.                 memFullErr      Not enough room in heap zone
  31674.                 nilHandleErr    NIL master pointer
  31675.                 memWZErr        Attempt to operate on a free block
  31676.  
  31677. æKY EmptyHandle
  31678. æFp Memory.p
  31679. æT PROCEDURE
  31680. æD PROCEDURE EmptyHandle(h: Handle);
  31681. æDT EmptyHandle(h);
  31682. æMM
  31683. æRI II-40
  31684. æC 
  31685. Trap macro  _EmptyHandle
  31686. On entry    A0:  h (handle)
  31687. On exit     A0:  h (handle)
  31688.             D0:  result code (word)
  31689.  
  31690. EmptyHandle purges the relocatable block whose handle is h from its heap zone and
  31691. sets its master pointer to NIL (making it an empty handle). If h is already empty,
  31692. EmptyHandle does nothing.
  31693.  
  31694. Note:  Since the space occupied by the block’s master pointer itself remains
  31695.        allocated, all handles pointing to it remain valid but empty. When you
  31696.        later reallocate space for the block with ReallocHandle, the master
  31697.        pointer will be updated, causing all existing handles to access the
  31698.        new block correctly.
  31699.  
  31700. The block whose handle is h must be unlocked, but need not be purgeable.
  31701.  
  31702. Result codes    noErr        No error
  31703.                 memWZErr     Attempt to operate on a free block
  31704.                 memPurErr    Attempt to purge a locked block
  31705.  
  31706. æKY ReallocHandle
  31707. æFp Memory.p
  31708. æT PROCEDURE
  31709. æD PROCEDURE ReallocHandle(h: Handle;byteCount: Size);
  31710. æDT ReallocHandle(h,byteCount);
  31711. æMM
  31712. æRI ReallocHandle procedure II-35
  31713.  
  31714. æC PROCEDURE ReallocHandle (h: Handle; logicalSize: Size);
  31715.  
  31716.             _________________________________________________
  31717.  
  31718.     Trap macro         _ReallocHandle
  31719.  
  31720.     On entry           A0:  h (handle)
  31721.                        D0:  logicalSize   (integer)
  31722.  
  31723.     On exit            A0:  original h or 0
  31724.                        D0:  result code  (integer)
  31725.             _________________________________________________
  31726.  
  31727.     ReallocHandle allocates a new relocatable block with a logical size
  31728. of logicalSize bytes. It then updates handle h by setting its master
  31729. pointer to point to the new block. The main use of this procedure is
  31730. to reallocate space for a block that has been purged. Normally h is an
  31731. empty handle, but it need not be:  if it points to an existing block,
  31732. that block is released before the new block is created.
  31733.  
  31734.     In case of an error, no new block is allocated and handle h is left
  31735. unchanged.
  31736.  
  31737.             _________________________________________________
  31738.  
  31739.     Assembly-language note:  On return from ReallocHandle, register
  31740.     A0 contains the original handle h, or 0 if no room could be
  31741.     found for the requested block.
  31742.             _________________________________________________
  31743.  
  31744.     Result codes
  31745.  
  31746.             noErr       Noerror
  31747.             memFullErr  Not enough room in zone
  31748.             memWZErr    Attempt to operate on a free block
  31749.             MemPurErr   Block is locked
  31750.  
  31751.  
  31752. æKY HSetRBit
  31753. æFp Memory.p
  31754. æT PROCEDURE
  31755. æD PROCEDURE HSetRBit(h: Handle);
  31756. æDT HSetRBit(h);
  31757. æRT 2
  31758. æRI IV-79, N2-3
  31759. æC 
  31760. Trap macro  _HSetRBit
  31761. On entry    A0:  h (handle)
  31762. On exit     D0:  result code (word)
  31763.  
  31764. HSetRBit sets the resource flag of a relocatable block’s master pointer.
  31765.  
  31766. æKY HClrRBit
  31767. æFp Memory.p
  31768. æT PROCEDURE
  31769. æD PROCEDURE HClrRBit(h: Handle);
  31770. æDT HClrRBit(h);
  31771. æRT 2
  31772. æRI IV-79, N2-3
  31773. æC 
  31774. Trap macro  _HClrRBit
  31775. On entry    A0:  h (handle)
  31776. On exit     D0:  result code (word)
  31777.  
  31778. HClrRBit clears the resource flag of a relocatable block’s master pointer.
  31779.  
  31780. æKY MoreMasters
  31781. æFp Memory.p
  31782. æT PROCEDURE
  31783. æTN A036
  31784. æD PROCEDURE MoreMasters;
  31785.     INLINE $A036;
  31786. æDT MoreMasters(paramList);
  31787. æMM
  31788. æRT 53
  31789. æRI II-31, N53
  31790. æC 
  31791. Trap macro  _MoreMasters
  31792.  
  31793. MoreMasters allocates another block of master pointers in the current heap zone. This
  31794. procedure is usually called very early in an application.
  31795.  
  31796. Result codes    noErr         No error
  31797.                 memFullErr    Not enough room in heap zone
  31798.  
  31799. æKY BlockMove
  31800. æFp Memory.p
  31801. æT PROCEDURE
  31802. æD PROCEDURE BlockMove(srcPtr: Ptr;destPtr: Ptr;byteCount: Size);
  31803. æDT BlockMove(srcPtr,destPtr,byteCount);
  31804. æRI II-44
  31805. æC 
  31806. Trap macro  _BlockMove
  31807. On entry    A0:  sourcePtr (pointer)
  31808.             A1:  destPtr (pointer)
  31809.             D0:  byteCount (long word)
  31810. On exit     D0:  result code (word)
  31811.  
  31812. BlockMove moves a block of byteCount consecutive bytes from the address designated by
  31813. sourcePtr to that designated by destPtr. No pointers are updated. BlockMove works
  31814. correctly even if the source and destination blocks overlap.
  31815.  
  31816. Result codes    noErr    No error
  31817.  
  31818. æKY MemError
  31819. æFp Memory.p
  31820. æT FUNCTION
  31821. æD FUNCTION MemError: OSErr;
  31822.     INLINE $3EB8,$0220;
  31823. æDT myVariable := MemError(paramList);
  31824. æRT 7
  31825. æRI II-44, N7-2
  31826. æC  
  31827. All Memory Manager routines (including the RecoverHandle function) return a result
  31828. code that you can examine by calling the MemError function.
  31829.  
  31830. Assembly-language note:  The trap _RecoverHandle doesn’t return a result code
  31831.                          in register D0. The result code of the most recent
  31832.                          call, however, is always stored in the global
  31833.                          variable MemErr.
  31834.  
  31835. FUNCTION MemError :  OSErr; [Not in ROM]
  31836.  
  31837. MemError returns the result code produced by the last Memory Manager routine called
  31838. directly by your program. (OSErr is an Operating System Utility data type declared as
  31839. INTEGER.)
  31840.  
  31841. Assemby-language note:  To get a routine’s result code from assembly language,
  31842.                         look in register D0 on return from the routine (except
  31843.                         for certain routines as noted).
  31844.  
  31845. æKY PurgeSpace
  31846. æFp Memory.p
  31847. æT PROCEDURE
  31848. æD PROCEDURE PurgeSpace(VAR total: LONGINT;VAR contig: LONGINT);
  31849. æDT PurgeSpace(total,contig);
  31850. æRI IV-78
  31851. æC 
  31852. Trap macro  _PurgeSpace
  31853.             _PurgeSpace ,SYS    (applies to system heap)
  31854. On exit     A0:  contig (long word)
  31855.             D0:  total (long word)
  31856.  
  31857. PurgeSpace returns in total the total amount of space in bytes that could be obtained
  31858. by a general purge (without actually doing the purge); this amount includes space
  31859. that is already free. The maximum contiguous space in bytes
  31860. (including already free space) that could be obtained by a purge is returned in
  31861. contig.
  31862.  
  31863. æKY HGetState
  31864. æFp Memory.p
  31865. æT FUNCTION
  31866. æD FUNCTION HGetState(h: Handle): SignedByte;
  31867. æDT myVariable := HGetState(h);
  31868. æRT 2
  31869. æRI IV-79, N2-3
  31870. æC 
  31871. Trap macro  _HGetState
  31872. On entry    A0:  h (handle)
  31873. On exit     D0:  flags (byte)
  31874.  
  31875. HGetState returns the byte that contains the flags of the master pointer for the
  31876. given handle; it’s used in conjunction with HSetState to save and restore the state
  31877. of the flags contained in this byte. You can save this byte, change the state of any
  31878. of the flags (using the routines described above), and then restore their original
  31879. state by passing the byte back to the HSetState procedure (described below).
  31880.  
  31881. æKY HSetState
  31882. æFp Memory.p
  31883. æT PROCEDURE
  31884. æD PROCEDURE HSetState(h: Handle;flags: SignedByte);
  31885. æDT HSetState(h,flags);
  31886. æRT 2
  31887. æRI IV-80, N2-3
  31888. æC 
  31889. Trap macro  _HSetState
  31890. On entry    A0:  h (handle)
  31891.             D0:  flags (byte)
  31892. On exit     D0:  result code (word)
  31893.  
  31894. HSetState is used in conjunction with HGetState; it sets the byte that contains the
  31895. flags of the master pointer for the given handle to the byte specified by flags.
  31896.  
  31897. æKY SetApplBase
  31898. æFp Memory.p
  31899. æT PROCEDURE
  31900. æD PROCEDURE SetApplBase(startPtr: Ptr);
  31901. æDT SetApplBase(startPtr);
  31902. æMM
  31903. æRI II-28
  31904. æC 
  31905. Trap macro  _SetAppBase
  31906. On entry    A0:  startPtr (pointer)
  31907. On exit     D0:  result code (word)
  31908.  
  31909. SetApplBase changes the starting address of the application heap zone to the address
  31910. designated by startPtr, and then calls InitApplZone. SetApplBase is normally called
  31911. only by the system itself; you should never need to call this procedure.
  31912.  
  31913. Since the application heap zone begins immediately following the end of the system
  31914. zone, changing its starting address has the effect of changing the size of the system
  31915. zone. The system zone can be made larger, but never smaller; if startPtr points to an
  31916. address lower than the current end of the system zone,
  31917. it’s ignored and the application zone’s starting address is left unchanged.
  31918.  
  31919. Warning:  Like InitApplZone, SetApplBase is a tricky operation, because the
  31920.           program’s code itself normally resides in the application heap zone.
  31921.           To do it safely, the code containing the SetApplBase call cannot be
  31922.           in the application zone.
  31923.  
  31924. Result codes    noErr    No error
  31925.  
  31926. æKY MaxApplZone
  31927. æFp Memory.p
  31928. æT PROCEDURE
  31929. æTN A063
  31930. æD PROCEDURE MaxApplZone;
  31931.     INLINE $A063;
  31932. æDT MaxApplZone(paramList);
  31933. æRT 103
  31934. æRI II-30, IV-77, 83, N39-1, N103
  31935. æC 
  31936. Trap macro  _MaxApplZone
  31937. On exit     D0:  result code (word)
  31938.  
  31939. MaxApplZone expands the application heap zone to the application heap limit without
  31940. purging any blocks currently in the zone. If the zone already extends to the limit,
  31941. it won’t be changed.
  31942.  
  31943. Assembly-language note:  To expand the application heap zone to the
  31944.                          application heap limit from assembly language,
  31945.                          call this Pascal procedure from your program.
  31946.  
  31947. Result codes    noErr    No error
  31948.  
  31949.  
  31950. æKY Menus.p
  31951. æKL AddResMenu
  31952. AppendMenu
  31953. CalcMenuSize
  31954. CheckItem
  31955. ClearMenuBar
  31956. CountMItems
  31957. DeleteMenu
  31958. DelMCEntries
  31959. DelMenuItem
  31960. DisableItem
  31961. DispMCInfo
  31962. DisposeMenu
  31963. DrawMenuBar
  31964. EnableItem
  31965. FlashMenuBar
  31966. GetItem
  31967. GetItemCmd
  31968. GetItemIcon
  31969. GetItemMark
  31970. GetItemStyle
  31971. GetMCEntry
  31972. GetMCInfo
  31973. GetMenu
  31974. GetMenuBar
  31975. GetMHandle
  31976. GetNewMBar
  31977. HiliteMenu
  31978. InitMenus
  31979. InitProcMenu
  31980. InsertMenu
  31981. InsertResMenu
  31982. InsMenuItem
  31983. InvalidMenuBar
  31984. MenuChoice
  31985. MenuKey
  31986. MenuSelect
  31987. NewMenu
  31988. PopUpMenuSelect
  31989. SetItem
  31990. SetItemCmd
  31991. SetItemIcon
  31992. SetItemMark
  31993. SetItemStyle
  31994. SetMCEntries
  31995. SetMCInfo
  31996. SetMenuBar
  31997. SetMenuFlash
  31998.  
  31999. hierMenu
  32000. hMenuCmd
  32001. mCalcItemMsg
  32002. MCEntry
  32003. MCEntryPtr
  32004. mChooseMsg
  32005. MCTable
  32006. MCTableHandle
  32007. MCTablePtr
  32008. mctAllItems
  32009. mctLastIDIndic
  32010. mDrawItemMsg
  32011. mDrawMsg
  32012. MenuCRsrc
  32013. MenuCRsrcHandle
  32014. MenuCRsrcPtr
  32015. MenuHandle
  32016. MenuInfo
  32017. MenuPtr
  32018. mPopUpMsg
  32019. mSizeMsg
  32020. noMark
  32021. textMenuProc
  32022.  
  32023. æKY noMark
  32024. æFp Menus.p
  32025. æT CONST
  32026. æD noMark = 0; {mark symbol for MarkItem}
  32027. æC 
  32028.  
  32029. æKY mDrawMsg
  32030. æFp Menus.p
  32031. æT CONST
  32032. æD 
  32033. { menu defProc messages }
  32034.  
  32035. mDrawMsg = 0;
  32036. æC 
  32037. _______________________________________________________________________________
  32038.  
  32039. »The Menu Definition Procedure
  32040.  
  32041. The menu definition procedure is usually written in assembly language, but may be
  32042. written in any high-level language.
  32043.  
  32044. Assembly-language note:  The procedure’s entry point must be at the beginning.
  32045.  
  32046. You may choose any name you wish for the menu definition procedure. Here’s how you
  32047. would declare one named MyMenu:
  32048.  
  32049. PROCEDURE MyMenu (message:  INTEGER; theMenu:  MenuHandle; VAR menuRect:  Rect;
  32050.                   hitPt:  Point; VAR whichItem:  INTEGER);
  32051.  
  32052. The message parameter identifies the operation to be performed. It has one of the
  32053. following values:
  32054.  
  32055. CONST  mDrawMsg   = 0; {draw the menu}
  32056.        mChooseMsg = 1; {tell which item was chosen and highlight it}
  32057.        mSizeMsg   = 2; {calculate the menu's dimensions}
  32058.  
  32059. The parameter theMenu indicates the menu that the operation will affect. MenuRect is
  32060. the rectangle (in global coordinates) in which the menu is located; it’s used when
  32061. the message is mDrawMsg or mChooseMsg.
  32062.  
  32063. Note:  MenuRect is declared as a VAR parameter not because its value is
  32064.        changed, but because of a Pascal feature that will cause an error
  32065.        when that parameter isn’t used.
  32066.  
  32067. The message mDrawMsg tells the menu definition procedure to draw the menu inside
  32068. menuRect. The current grafPort will be the Window Manager port. (For details on
  32069. drawing, see the QuickDraw chapter.) The standard menu definition procedure figures
  32070. out how to draw the menu items by looking in the menu record at the data that defines
  32071. them; this data is described in detail under “Formats of Resources for Menus” below.
  32072. For menus of your own definition, you may set up the data defining the menu items any
  32073. way you like, or even omit it altogether
  32074. (in which case all the information necessary to draw the menu would be in the menu
  32075. definition procedure itself). You should also check the enableFlags field of the menu
  32076. record to see whether the menu is disabled (or whether any of the menu items are
  32077. disabled, if you’re using all the flags), and if so, draw it in gray.
  32078.  
  32079. Note:  MenuKey will always search the menuData field of a MenuInfo record for
  32080.        Command-key equivalents until it finds a zero where a standard menu
  32081.        title should be, even if the MenuInfo record is for one of your own
  32082.        'MDEF' resources. To prevent MenuKey from finding a Command-key
  32083.        equivalent in your MenuInfo record, put a couple of bytes of zeros
  32084.        just after the menu’s title.
  32085.  
  32086. Warning:  Don’t change the font from the system font for menu text.
  32087.           (The Window Manager port uses the system font.)
  32088.  
  32089. When the menu definition procedure receives the message mChooseMsg, the hitPt parameter
  32090. is the mouse location (in global coordinates), and the whichItem parameter is the
  32091. item number of the last item that was chosen from this menu
  32092. (whichItem is initially set to 0). The procedure should determine whether the mouse
  32093. location is in an enabled menu item, by checking whether hitPt is inside menuRect,
  32094. whether the menu is enabled, and whether hitPt is in an enabled menu item:
  32095.  
  32096.   •  If the mouse location is in an enabled menu item, unhighlight whichItem
  32097.      and highlight the new item (unless the new item is the same as the
  32098.      whichItem), and return the item number of the new item in whichItem.
  32099.   •  If the mouse location isn’t in an enabled item, unhighlight whichItem
  32100.      and return 0.
  32101.  
  32102. Note:  When the Menu Manager needs to make a chosen menu item blink, it
  32103.        repeatedly calls the menu definition procedure with the message
  32104.        mChooseMsg, causing the item to be alternately highlighted and
  32105.        unhighlighted.
  32106.  
  32107. Finally, the message mSizeMsg tells the menu definition procedure to calculate the
  32108. horizontal and vertical dimensions of the menu and store them in the menuWidth and
  32109. menuHeight fields of the menu record.
  32110.  
  32111. The following section describes changes to the default menu definition procedure
  32112. ('MDEF' resource 0); some of the information presented in this section is accessible
  32113. only through assembly language.
  32114.  
  32115. Note:  These features will work with the 64K ROM if the new menu definition
  32116.        procedure is in the system resource file.
  32117.  
  32118. »Variable Size Fonts
  32119.  
  32120. Menus are displayed in the system font. Since the system font and font size can now
  32121. be changed, the menu definition procedure calls the QuickDraw procedure GetFontInfo
  32122. for the system font to determine the height of menu items
  32123.  
  32124. »Scrolling Menus
  32125.  
  32126. The default menu definition procedure allows longer menus by implementing automatic
  32127. scrolling. If the entire menu cannot be drawn on screen, dragging the cursor below
  32128. the last displayed item will cause the items in the menu to scroll up. Similarly, if
  32129. items have been scrolled past the top of the menu, dragging the cursor into the
  32130. highlighted portion of the menu bar will cause the menu to scroll back down. The
  32131. maximum number of items that can be drawn on the standard Macintosh screen with this
  32132. new menu definition function is 19 (instead of 20).
  32133.  
  32134. Warning:  You should not disable any menu items in a menu containing more than
  32135.           31 items because the enableFlags field of the MenuInfoRec can only
  32136.           handle 31 items.
  32137.  
  32138. æKY mChooseMsg
  32139. æFp Menus.p
  32140. æT CONST
  32141. æD mChooseMsg = 1;
  32142. æC 
  32143.  
  32144. æKY mSizeMsg
  32145. æFp Menus.p
  32146. æT CONST
  32147. æD mSizeMsg = 2;
  32148. æC 
  32149.  
  32150. æKY mDrawItemMsg
  32151. æFp Menus.p
  32152. æT CONST
  32153. æD mDrawItemMsg = 4;
  32154. æC 
  32155.  
  32156. æKY mCalcItemMsg
  32157. æFp Menus.p
  32158. æT CONST
  32159. æD mCalcItemMsg = 5;
  32160. æC 
  32161.  
  32162. æKY textMenuProc
  32163. æFp Menus.p
  32164. æT CONST
  32165. æD textMenuProc = 0;
  32166. æC 
  32167.  
  32168. æKY hMenuCmd
  32169. æFp Menus.p
  32170. æT CONST
  32171. æD hMenuCmd = 27; {itemCmd == 0x001B ==> hierarchical menu}
  32172. æC 
  32173.  
  32174. æKY hierMenu
  32175. æFp Menus.p
  32176. æT CONST
  32177. æD hierMenu = -1; {a hierarchical menu - for InsertMenu call}
  32178. æC 
  32179.  
  32180. æKY mPopUpMsg
  32181. æFp Menus.p
  32182. æT CONST
  32183. æD mPopUpMsg = 3; {menu defProc messages - place yourself}
  32184. æC 
  32185.  
  32186. æKY mctAllItems
  32187. æFp Menus.p
  32188. æT CONST
  32189. æD mctAllItems = -98; {search for all Items for the given ID}
  32190. æC 
  32191.  
  32192. æKY mctLastIDIndic
  32193. æFp Menus.p
  32194. æT CONST
  32195. æD mctLastIDIndic = -99; {last color table entry has this in ID field}
  32196. æC 
  32197.  
  32198. æKY MenuInfo
  32199. MenuPtr
  32200. MenuHandle
  32201. æFp Menus.p
  32202. æT RECORD
  32203. æD MenuPtr = ^MenuInfo;
  32204. MenuHandle = ^MenuPtr;
  32205. MenuInfo = RECORD
  32206.     menuID: INTEGER;
  32207.     menuWidth: INTEGER;
  32208.     menuHeight: INTEGER;
  32209.     menuProc: Handle;
  32210.     enableFlags: LONGINT;
  32211.     menuData: Str255;
  32212.     END;
  32213. æC 
  32214. _______________________________________________________________________________
  32215.  
  32216. »MENU MANAGER DATA STRUCTURES
  32217. _______________________________________________________________________________
  32218.  
  32219. The Menu Manager keeps all the information it needs for its operations on a particular
  32220. menu in a menu record. The menu record contains the following:
  32221.  
  32222.   •  The menu ID, a number that identifies the menu. The menu ID can be the
  32223.      same number as the menu’s resource ID, though it doesn’t have to be.
  32224.   •  The menu title.
  32225.   •  The contents of the menu—the text and other parts of each item.
  32226.   •  The horizontal and vertical dimensions of the menu, in pixels. The menu
  32227.      items appear inside the rectangle formed by these dimensions; the black
  32228.      border and shadow of the menu appear outside that rectangle.
  32229.   •  A handle to the menu definition procedure.
  32230.   •  Flags telling whether each menu item is enabled or disabled, and whether
  32231.      the menu itself is enabled or disabled.
  32232.  
  32233. The data type for a menu record is called MenuInfo. A menu record is referred to by a
  32234. handle:
  32235.  
  32236. TYPE  MenuPtr    = ^MenuInfo;
  32237.       MenuHandle = ^MenuPtr;
  32238.  
  32239. You can store into and access all the necessary fields of a menu record with Menu
  32240. Manager routines, so normally you don’t have to know the exact field names. However,
  32241. if you want more information about the exact structure of a menu record—if you’re
  32242. defining your own menu types, for instance—it’s given below.
  32243.  
  32244. _______________________________________________________________________________
  32245.  
  32246. »The MenuInfo Data Type
  32247.  
  32248. The type MenuInfo is defined as follows:
  32249.  
  32250. TYPE  MenuInfo = RECORD
  32251.                    menuID:       INTEGER;  {menu ID}
  32252.                    menuWidth:    INTEGER;  {menu width in pixels}
  32253.                    menuHeight:   INTEGER;  {menu height in pixels}
  32254.                    menuProc:     Handle;   {menu definition procedure}
  32255.                    enableFlags:  LONGINT;  {tells if menu or items are enabled}
  32256.                    menuData:    Str255     {menu title (and